473,804 Members | 3,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebResourceAttr ibute: 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
EmbeddedResourc es and WebResourceAttr ibutes 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("im age1.jpg", "image/jpeg")]
[assembly: WebResource("he lp.htm", "text/html", PerformSubstitu tion = true)]
namespace AssemblyWithWeb Resources
{
public class EmptyClass { }
}
*************** *************** ******//
When compiled, I am able to successfully extract the resources so I know
they are embedded correctly:
//*************** *************** ******
System.IO.Strea m s =
resourceAssembl y.GetManifestRe sourceStream("A ssemblyWithWebR esources.help.h tm");
return s.ReadToEnd();
*************** *************** ******//
From my webpage, I use the following to get a web resource url:

//*************** *************** ******
Page.ClientScri pt.GetWebResour ceUrl(typeof(As semblyWithWebRe sources.EmptyCl ass), "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 2258
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 GetWebResourceU rl? 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
EmbeddedResourc es and WebResourceAttr ibutes 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("im age1.jpg", "image/jpeg")]
[assembly: WebResource("he lp.htm", "text/html", PerformSubstitu tion = true)]
namespace AssemblyWithWeb Resources
{
public class EmptyClass { }
}
*************** *************** ******//
When compiled, I am able to successfully extract the resources so I know
they are embedded correctly:
//*************** *************** ******
System.IO.Strea m s =
resourceAssembl y.GetManifestRe sourceStream("A ssemblyWithWebR esources.help.h tm");
return s.ReadToEnd();
*************** *************** ******//
From my webpage, I use the following to get a web resource url:

//*************** *************** ******
Page.ClientScri pt.GetWebResour ceUrl(typeof(As semblyWithWebRe sources.EmptyCl ass), "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
2035
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 is coming back true, so the next line runs, which attempts to get the next row from the dataset. This brings back nothing. On the queries I'm running right now, the first row will be fetched, but then no further rows. If I expect 20 rows back, I...
8
5484
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
1
4251
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)) { print("<option> $row</option>"); } ?>
4
2824
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 are trying to use is on a CD-ROM or other removable disk that is not available. Insert the 'Microsoft Visual Studio 2005 Professional Edition - ENU' and click OK." Since I bought the upgrade, I don't have a CD labeled 'Microsoft Visual Studio...
2
16938
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 not a valid MySQL result resource in /home/jplane/certcent/phpweb/quiz/index.php on line 21 PHP CODE:
2
2196
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 invocation. ---> System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. at
3
1954
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 has logged in. I set a loggedin session in the log in page, which I have tested and works fine in other scripts. I am displaying news on the homepage (which is stored in a mysql database), and this works fine when the user accesses the homepage...
11
13216
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')", $link2); As far as understand the problem is that $link2 is "not a valid MySQL-
7
16664
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. Warning: fclose(): 15 is not a valid stream resource in /mnt/raid/www/intra/admin/ts2/test2.php on line 174 Warning: fclose(): 20 is not a valid stream resource in /mnt/raid/www/intra/admin/ts2/test2.php on line 174 Warning: fclose(): 25 is not a...
0
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.