vdboor
vdboor

Reputation: 22526

Unable to find web resource from assembly

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:

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.

Upvotes: 2

Views: 1757

Answers (1)

djdd87
djdd87

Reputation: 68456

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

Should be:

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

Upvotes: 4

Related Questions