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

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
Steve

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.

As an extreme measure you could try a repair installation of the .net framework...
I've never encountered or even heard of this problem before so I'm afraid I don't have a better solution.

Related

Session Variables Work in Chrome, Firefox but Fail in IE11

We recently upgraded a web server to Win2012 (from 2008) and started using ActiveDirectory. The main web site uses an external order form written in C# (ASP.NET 2.0). Everything was working fine in the old server until we migrated. Now I get errors when trying to read Session variables in IE 11 (everything works with other browsers).
This is the error I get with the line causing it:
Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 974: private void WriteTextConfirmation ()
Line 975: {
Line 976: string sFolders_OrderForm = Session ["Folders_OrderForm"].ToString ();
Line 977: string sOrderNumber = Session ["OrderNumber"].ToString ();
Line 978:
Source File: d:\Web Sites\Order Form\SubmitOrder.aspx.cs Line: 976
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
SubmitOrder.WriteTextConfirmation() in d:\Web Sites\Order Form\SubmitOrder.aspx.cs:976
SubmitOrder.Page_Load(Object sender, EventArgs e) in d:\Web Sites\Order Form\SubmitOrder.aspx.cs:1189
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +41
System.Web.UI.Control.OnLoad(EventArgs e) +131
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427
The problem is that the Session variables that are being read are null. They should be set in the Default form and passed for use in the SubmitOrder form. These variables work with FireFox and Chrome but fail in IE. I'm not sure why this would occur.
We had the same problem and setting the session state to cookieless in Web.config fixed our problem.
Since you are saying that it is browser-specific, it would have to be a setting with the browser. Maybe you have cookies turned off?
Update
I did some searching, and it looks like it could still be cookie related.
Session variable empty in iis7 application
Another common cause of this issue is when the server name contains
underscores (e.g. DEV_TEST). Underscores aren't allowed as host names,
and could interfere with the ability to set cookies.
This Server Fault question has a few answers saying the same thing:
https://serverfault.com/questions/178733/iis-7-0-does-not-keep-session-variables
And another SO question saying underscores:: IE8 does not keep Session Variables
More from Google: https://www.google.com/search?q=iis+application+session+variables+IE

WF 4.0 can't get to resume workflow on the staging/production environment

I have developed various registeration workflows using WF4.0. Each work flow has various bookmarks. I am using the registeration wf for an asp.net application.
I tested the asp.net application locally and it is working fine( Starting WF, Persisting to db and resuming bookmarks). When I try to test it on the staging server, everything goes messy. I can no longer resume wfs and I get an error message :
System.Runtime.DurableInstancing.InstancePersistenceCommandException
was unhandled by user code Message=The execution of the
InstancePersistenceCommand named
{urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflow
was interrupted by an error. Source=System.Runtime.DurableInstancing
StackTrace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Runtime.DurableInstancing.InstancePersistenceContext.OuterExecute(InstanceHandle
initialInstanceHandle, InstancePersistenceCommand command, Transaction
transaction, TimeSpan timeout)
at System.Runtime.DurableInstancing.InstanceStore.Execute(InstanceHandle
handle, InstancePersistenceCommand command, TimeSpan timeout)
at System.Activities.WorkflowApplication.PersistenceManager.Load(TimeSpan
timeout)
at System.Activities.WorkflowApplication.LoadCore(TimeSpan timeout, Boolean loadAny)
at System.Activities.WorkflowApplication.Load(Guid instanceId, TimeSpan timeout)
at System.Activities.WorkflowApplication.Load(Guid instanceId)
at CEO_StartUpCEORegisterationTest.LoadInstance(Guid wfInstanceId) in c:\Users\Kunoichi\Documents\Visual Studio
2010\Projects\CMERegistrationSystem\RegistrationPortal\CEO\StartUpCEORegisterationTest.aspx.cs:line
64
at CEO_StartUpCEORegisterationTest.Page_Load(Object sender, EventArgs e) in c:\Users\Kunoichi\Documents\Visual Studio
2010\Projects\CMERegistrationSystem\RegistrationPortal\CEO\StartUpCEORegisterationTest.aspx.cs:line
44
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.Data.SqlClient.SqlException
Message=Index 'NCIX_KeysTable_SurrogateInstanceId' on table 'KeysTable' (specified in the FROM clause) does not exist.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=16
LineNumber=211
Number=308
Procedure=LoadInstance
Server=
State=1
StackTrace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Activities.DurableInstancing.SqlWorkflowInstanceStoreAsyncResult.SqlCommandAsyncResultCallback(IAsyncResult
result)
I know that this is quite verbose. But I have been banging my head against the wall for more than a week. I did search and all I came to know was to work on ms dtc. I enabled it on the staging server , I installed application server on the staging server and I am still getting the same error. I would appreciate if anyone could help with the problem. Thanks in advance :)
Who created the persistence store being used on the staging server? What schema was used to create it? Look for differences between the scripts used locally and in production.

asp v2.0 iis7 machine.config amended to contain maxconnection="192" stopped calls working to third party web services

I added the following to:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
<system.net>
<connectionManagement>
<add address="*" maxconnection="192" />
</connectionManagement>
</system.net>
After saving the application was running fine. However calls to third party web services/web method (MICROSOFT MAPPOINT, another API unrelated to Microsoft i.e two independent references) failed to work. One of which returned the following error:
--------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
WebApp.AddUpdate.LoadWebServiceRecord() +7740
WebApp.AddUpdate.MessageBox1_YesClicked(Object sender, EventArgs e) +51
WebApp.webcontrols.MessageBox.Yes_Click(Object sender, EventArgs e) +140
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +28
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2980
Version Information: Microsoft .NET Framework Version:2.0.50727.4206; ASP.NET Version:2.0.50727.4209
i.e exception above appears to have been created as it could no longer contact the service.
Remove the amendment in machine.config i.e remove the maxconnection rows and it all works fine again. Any idea why?
Do i need to declare the third party reference's in maxconnection?
if so would it be possible to provide and example?
Generally speaking, you shouldn't have to adjust it manually. ASP.NET 2 sets processModel to auto by default which among other things automatically scales maxconnections for the # of CPUs available (12N).
As to the error you're seeing, there must be more than meets than eye; the two are completely unrelated and there is no reason any maxconnection value would trigger a NullReferenceException in your application.
HTH
References:
http://technet.microsoft.com/en-us/magazine/2006.11.insidemscom.aspx
http://msdn.microsoft.com/en-us/library/7w2sway1.aspx

NullReferenceException in Page_Load

I have developed my project in asp.net 3.5. It works fine in localhost, when i published in the web sometimes its working fine but sometimes i am getting the following error. I think some error while conecting to the server but dont know exactly. Please help me to do it fine.
Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Result.Page_Load(Object sender, EventArgs e) +128 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
Enable debugging in your web.config file (Debug="True") and turn RemoteErrors="On". This will provide a much more detailed error message so that you can find what is throwing the NullReferenceException. Once solved, remember to reset these configurations.
Check the code inside your Page_Load method, its throwing a null refernce exception
HTTP Request pipeline is giving the issue here not the page.
you need to check and trace HTTPContext here

'License expired' error when dynamically generating Excel docs in ASP.NET

Anyone familiar with error below? When I run my webapp to generate a dynamic excel doc from my local machine it works fine but when the same piece of code is invoked on the server I get the below error. It seems like it's a permissions issues since it works on my machine but not the server but I don't know where to start in order to pinpoint the problem. Any guidance/help is greatly appreciated!
Server Error in '/' Application.
--------------------------------------------------------------------------------
This command is unavailable because the license to use this application has expired.
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.Runtime.InteropServices.COMException: This command is unavailable because the license to use this application has expired.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x800a03ec): This command is unavailable because the license to use this application has expired.]
Microsoft.Office.Interop.Excel.Workbooks.Add(Object Template) +0
PaymentsReport.Page_Load(Object sender, EventArgs e) +70
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Office/Excel is installed on the server and I can open/save excel docs on the server. Could it be the version of excel on the server vs. my local machine? If so how can I make sure I have the latest on the server?
Apart from being installed, you need to make sure the application is activated on the server:
http://support.microsoft.com/kb/294973
Has details on how to do this.
Using Office Interop requires that the Office components you're using actually be installed on the server.
I'm gonna take a WAG and say that you just can't slap any old copy of Office on a server and let multiple users access it via your website. You need to look at the licensing restrictions for using MS office in a server environment.
Do you have a licensed, activated copy of Excel on the server? It probably works on your local machine because you have Office/Excel installed locally.

Resources