Embedded resources when using virtual path provider

1.1k views Asked by At

I have successfully created my own virtual path provider 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?

1

There are 1 answers

0
apros On BEST ANSWER

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.