Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > WebResource problem

Thread Tools

WebResource problem

Mark Denardo
Posts: n/a
I'm having a problem when building a Custom Control that includes embedded WebResources. (using VB.NET 2.0)

My namespace I'm using is: myCompany.CustomControl
And the image I'm trying to reference is: Images/myImage.gif

From reading my .NET books and looking through numerous articles on WebResources, the way I should be able to use this in code seems to be something like so:

=> I declare it like so:
<Assembly: WebResource("myCompany.CustomControls.Images.myIma ge.gif", "image/gif")>

=> And later reference it like so:
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompany.CustomControls.Images.myImage.gif")

But this didn't work. But after playing around, I changed my Namespace to myCompanyCustomControls (took out the dot reference)
and moved myImage.gif to the root level and then used:

<Assembly: WebResource("myCompanyCustomControls.myImage.gif", "image/gif")>
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompanyCustomControls.myImage.gif")

and then it worked.

I tried a number of different things, but cannot get anything working with any additional dot references.

Now I can live with leaving my resources in the root directory, but I need my Namespace to be myCompany.CustomControls

Anyone see what I may be doing wrong. All of the example articles on the internet are in C# and frankly so are my books (C# is my primary language, but my company uses VB.NET). I wondering if I need to do something special in VB?

Any help on this would be much appreciated.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript problem with WebResource.axd Luigi ASP .Net 2 03-06-2010 03:31 AM
WebResource.axd Problem Hemant ASP .Net 3 09-04-2009 05:44 PM
Webresource.axd problem in 2.0 =?Utf-8?B?YXd5bA==?= ASP .Net 11 07-16-2009 11:40 AM
WebResource and dynamically loaded assemblies problem Konstantin Gonikman ASP .Net 0 02-17-2006 02:51 PM
Webresource.axd problem in 2 beta =?Utf-8?B?Z3JlZ3g3Mw==?= ASP .Net 1 11-01-2005 05:08 AM