开发者

Embedded resources when using virtual path provider

I have successfully created my own virtual path provi开发者_如何学运维der to load a user control embedded in an assembly. The problem I am facing is I cannot use any embedded string resource in MyUserControl.ascx:

 <Label runat="server" ID="MyLabel" Text="<%Resources: SR, Welcome%>"/>

This will cause IIS to throw a compilation exception at runtime saying the resource SR.Welcome is not found. I guess ASP.NET runtime looks for the string resource SR in the main assembly instead of the one that contains my user control.

Does anyone have this problem and know how to make it work?


For this issue you should use ClientScriptManager.GetWebResourceUrl Method soon. This is a basic approach for extracting embedded resources. See, MSDN article that give an overview of use of resource files in .NET development. There is an example about using embedded in .dll resources in ASP.NET.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜