ASP.NET: "The resource class for this page was not found."

steve_hayter used Ask the Experts™
Hi all,

Myself and a colleague have recently upgraded to Windows Vista, and have been using it to develop ASP.NET applications with Visual Studio 2008 without many issues. And up until this morning, I *had* been managing to use local resources fine too.

However, this morning, my application suddenly stopped working with local resources, in the sense that any controls with a meta:resourcekey attribute suddenly display an empty string. At first, I thought it was something I had done to the application, so I created a brand new web application, added a label to an ASPX page, and generated a local resource from it. But running it has the same issue - the text simply isn't displayed. See attached screenshot for the example, and its output.

However, running it on my colleague's machine (who also has Vista), works without issue.

Incidently, if I try to get the value in the code behind, it throws this exception:


Server Error in '/Resources' Application.
The resource class for this page was not found.  Please check if the resource file exists and try again.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The resource class for this page was not found.  Please check if the resource file exists and try again.

Source Error:

Line 12:             protected void Page_Load(object sender, EventArgs e)
Line 13:             {
Line 14:                   object x = HttpContext.GetLocalResourceObject("~/Default.aspx", "lblTestResource1.Text");
Line 15:             }
Line 16:       }

Source File: C:\inetpub\wwwroot.Net2\Standalone\Resources\Resources\Default.aspx.cs    Line: 14

Stack Trace:

[InvalidOperationException: The resource class for this page was not found.  Please check if the resource file exists and try again.]
   System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() +2468866
   System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() +20
   System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture) +15
   System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) +21
   System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfo culture) +38
   System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey) +6
   Resources._Default.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot.Net2\Standalone\Resources\Resources\Default.aspx.cs:14
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074


Anyone have any idea? The weird thing is that using resources *was* working. I have tried restarting my computer, and clearing my Temporary ASP.NET files - but the issue remains.

Many thanks

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


Points increased
Okay, I did a system restore to a couple of days previously, and it works fine now. Bizarre, as I (knowingly) made no changes to system files or anything.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial