ASP.NET HttpContext.GetLocalResourceObject() throws InvalidOperationException
Posted
by Dylan Lin
on Stack Overflow
See other posts from Stack Overflow
or by Dylan Lin
Published on 2010-06-08T12:25:13Z
Indexed on
2010/06/08
12:52 UTC
Read the original article
Hit count: 658
Hi all,
Let's say we have such site structure:
App_LocalResources
|- A.aspx.resx
|- B.aspx.resx
A.aspx
B.aspx
Now I use HttpContext.GetLocalResourceObject("~/A.aspx") in A.aspx.cs, and it works fine. But if I use HttpContext.GetLocalResourceObject("~/A.aspx") in B.aspx.cs, it throws an exception:
The resource class for this page was not found. Please check if the resource file exists and try again.
Exception Details: System.InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.
How can I resolve this problem? I want to read the local resources from an external page, and I don't want to read the .resx file myself. Thanks :-)
© Stack Overflow or respective owner