开发者

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:

  • 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开发者_Go百科 all.


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

Should be:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜