views:

73

answers:

1

I'm trying to load web resources from a linked assembly. Whatever I try, I get the exception:

Web resource 'MyNameSpace.scripts.jquery-min.js' was not found.

I'm using the following code to load it:

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

What am I missing / doing wrong here, causing that exception?


My observations so far:

  • In the Reflector these resource is visible, and named as MyNameSpace.scripts.jquery-min.js
  • In the AssemblyInfo.cs file of the project, the file is registered as:

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

  • The file lives in the 'scripts' directory

On a sidenote, I've tried using Page.ClientScript.GetWebResourceUrl() but this generates an URL without checking if the resource exists. It also seems WebResource.axd is not mapped in Web.config at all.

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

Should be:

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