WebResource problem

Discussion in 'ASP .Net' started by Mark Denardo, Apr 23, 2007.

  1. Mark Denardo

    Mark Denardo Guest

    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.myImage.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.

    Mark
     
    Mark Denardo, Apr 23, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Z3JlZ3g3Mw==?=

    Webresource.axd problem in asp.net 2 beta

    =?Utf-8?B?Z3JlZ3g3Mw==?=, Sep 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    758
    Jayman13
    Nov 1, 2005
  2. =?Utf-8?B?YXd5bA==?=

    Webresource.axd problem in asp.net 2.0

    =?Utf-8?B?YXd5bA==?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    26,366
    wes.kinzett
    Jul 16, 2009
  3. Konstantin Gonikman

    WebResource and dynamically loaded assemblies problem

    Konstantin Gonikman, Feb 17, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    406
    Konstantin Gonikman
    Feb 17, 2006
  4. Hemant

    WebResource.axd Problem

    Hemant, Sep 3, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    1,316
    Scott M.
    Sep 4, 2009
  5. Luigi
    Replies:
    2
    Views:
    2,169
Loading...

Share This Page