Could not find web resource from assembly

I am trying to load web resources from a linked assembly. No matter what I try, I get an exception:

The web resource "MyNameSpace.scripts.jquery-min.js" was not found.

I am using the following code to download it:

ScriptManager.RegisterClientScriptResource(this, typeof(MyNameSpace.SomeClass), "MyNameSpace.scripts.jquery-min.js");

      

What am I missing / doing wrong here by throwing this exception?


My observations so far:

  • In the reflector, this resource is visible and named as MyNameSpace.scripts.jquery-min.js

  • In the AssemblyInfo.cs

    project file, the file is registered as:

    [assembly: WebResource("scripts/jquery-min.js", "text/javascript")]

  • The file is located in the 'scripts' directory

In a browser, I tried to use Page.ClientScript.GetWebResourceUrl()

, but this creates a URL without checking for the existence of the resource. It looks like it WebResource.axd

doesn't appear at all in Web.config

.

+2


a source to share


1 answer


[assembly: WebResource("scripts/jquery-min.js", "text/javascript")]

      

Should be:



[assembly: WebResource("MyNameSpace.scripts.jquery-min.js", "text/javascript")]

      

+4


a source







All Articles