473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

WebResourceAttribute: cannot get a valid web resource url!

coz
Someone please help! I cannot for the life of me get a web resource in
asp.net 2.0 to return any content.

I know I have correctly embedded my resources (because I can manually get
the resources from my assemblies at runtime.)

The URLs I get back are valid (they throw no errors) but they return zero
content. I get a broken page from text/html resources and broken images, etc.
I can get an error if I use an invalid resource name, so I know my resource
names are correct when I get no error.

I have boiled a project down to nothing but an Assembly with
EmbeddedResources and WebResourceAttributes declared, a webpage that gets a
URL for each exposed resource, and even an NUnitASP project to test the
results. I get no content no matter what I do:

I have two resources, a simple html page and an image. My assembly looks
like tihs:

//************************************
[assembly: WebResource("image1.jpg", "image/jpeg")]
[assembly: WebResource("help.htm", "text/html", PerformSubstitution = true)]
namespace AssemblyWithWebResources
{
public class EmptyClass { }
}
************************************//
When compiled, I am able to successfully extract the resources so I know
they are embedded correctly:
//************************************
System.IO.Stream s =
resourceAssembly.GetManifestResourceStream("Assemb lyWithWebResources.help.htm");
return s.ReadToEnd();
************************************//
From my webpage, I use the following to get a web resource url:

//************************************
Page.ClientScript.GetWebResourceUrl(typeof(Assembl yWithWebResources.EmptyClass), "help.htm");
************************************//

This returns valid URLs that dont cause any errors, but also return no data.
I have been through every posting i can find online and nothing gets me past
this problem. Can someone please tell me what I am doing wrong? I know it
isn't a namespace issue (you used to have to append the namespace before the
resource name) because that does cause an error from the generated URL.

I have posted my solution online, if someone would please download it and
kick it around:

http://fluidnature.com/test/TestOfWebResources.zip

Thank you,

f
Jan 1 '06 #1
1 2226
coz
I have re-posted my zip file, after removing the NUnitAsp project and
dependencies because you might not have it installed and its not required to
see the problem. I also I fixed the solution file reference to the website
directory.

Now all you need is VS2005. Extract the contents, open the solution and run
it:

http://fluidnature.com/test/TestOfWebResources.zip

Please, somebody look at this project and tell me what I did wrong embedding
the included resources and exposing them via GetWebResourceUrl? I have found
several other people having this same problem, so it would definately provide
benefit to the community.

Thank you very much,

coz

"coz" wrote:
Someone please help! I cannot for the life of me get a web resource in
asp.net 2.0 to return any content.

I know I have correctly embedded my resources (because I can manually get
the resources from my assemblies at runtime.)

The URLs I get back are valid (they throw no errors) but they return zero
content. I get a broken page from text/html resources and broken images, etc.
I can get an error if I use an invalid resource name, so I know my resource
names are correct when I get no error.

I have boiled a project down to nothing but an Assembly with
EmbeddedResources and WebResourceAttributes declared, a webpage that gets a
URL for each exposed resource, and even an NUnitASP project to test the
results. I get no content no matter what I do:

I have two resources, a simple html page and an image. My assembly looks
like tihs:

//************************************
[assembly: WebResource("image1.jpg", "image/jpeg")]
[assembly: WebResource("help.htm", "text/html", PerformSubstitution = true)]
namespace AssemblyWithWebResources
{
public class EmptyClass { }
}
************************************//
When compiled, I am able to successfully extract the resources so I know
they are embedded correctly:
//************************************
System.IO.Stream s =
resourceAssembly.GetManifestResourceStream("Assemb lyWithWebResources.help.htm");
return s.ReadToEnd();
************************************//
From my webpage, I use the following to get a web resource url:

//************************************
Page.ClientScript.GetWebResourceUrl(typeof(Assembl yWithWebResources.EmptyClass), "help.htm");
************************************//

This returns valid URLs that dont cause any errors, but also return no data.
I have been through every posting i can find online and nothing gets me past
this problem. Can someone please tell me what I am doing wrong? I know it
isn't a namespace issue (you used to have to append the namespace before the
resource name) because that does cause an error from the generated URL.

I have posted my solution online, if someone would please download it and
kick it around:

http://fluidnature.com/test/TestOfWebResources.zip

Thank you,

f

Jan 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: lawrence | last post by:
I posted before, but have now narrowed my problem down to this method. At the start of the method, I test to make sure that I have a resource, a pointer to data returned from a database. This test...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: Robert Morgan | last post by:
|I'm trying to run a query on a database using php and postgres functions ||<?php db_connect(); $stat = pg_exec($connstr,"SELECT WSID from tblWorkstation "); while ($row = pg_fetch_rows($stat))...
4
by: WWengert | last post by:
When I open a previously created solution it opens fine and I can edit and run it but when I attempt to Build or Rebuild the Setup Project in that solution I get a popup saying "The feature you...
2
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is...
2
by: Amelyan | last post by:
Why does this happen? How to fix it? Once in a while I get error in ~/ScriptResource.axd?d=... System.Reflection.TargetInvocationException: Exception has been thrown by the target of an...
3
by: Hazza | last post by:
Hi, I am using PHP and mysql to create a website. I am fairly new to PHP, and thus am grateful to anyone who helps! Firstly I am running a homepage, that displays additional content if a user...
11
by: Kurda Yon | last post by:
Hi, I got this warning: mysql_query(): 4 is not a valid MySQL-Link resource. The line which cause this warning is: mysql_query("insert into $tablename (id,priority) values('$id', '0.00')",...
7
by: phpnewbie26 | last post by:
I'm not sure what this error means and was wondering if anyone knew what the problem is and how it can be fixed. This error comes out multiple times but each time the number is different. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.