K
kingski
I have a web site created with ASP.NET 1.1. availability
Global.asax:
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs
e)
{
SetCulture();
}
private void SetCulture()
{
string culturePref =
(string)ConfigurationSettings.AppSettings["DefaultCulture"];
if (Session["My_Session"] != null &&
Session["My_Session"].ToString().Length > 0)
culturePref =
Session["My_Session"].ToString();
Bla bla .
}
After migrating this web site to ASP.NET 2.0 in event viewer start appears
this:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10.05.2006 16:24:07
Event time (UTC): 10.05.2006 14:24:07
Event ID: 6d22d64bd6174ea297a527bf2953c52b
Event sequence: 27
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2040315736/Root-2-127917444735263147
Trust level: Full
Application Virtual Path: /
Application Path: D:\Inetpub\www.luup.com\
Machine name: VINSON
Process information:
Process ID: 5352
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: HttpException
Exception message: Session state is not available in this context.
Request information:
Request URL:
https://www.vinson.com/webresource.axd?d=w8xrHbl9QllPRpFUhORWyw2&t=632775007064853919
Request path: /webresource.axd
User host address: 191.128.1.222
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 23
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Web.HttpApplication.get_Session()
at MyComp.Web.MyCompWeb.Global.SetCulture()
at
MyComp.Web.MyCompWeb.Global.Application_PreRequestHandlerExecute(Object
sender, EventArgs e)
at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
What is the first place /method/ in which is possible to access session in
Global.asax?
Any ideas what other can cause this exception?
Global.asax:
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs
e)
{
SetCulture();
}
private void SetCulture()
{
string culturePref =
(string)ConfigurationSettings.AppSettings["DefaultCulture"];
if (Session["My_Session"] != null &&
Session["My_Session"].ToString().Length > 0)
culturePref =
Session["My_Session"].ToString();
Bla bla .
}
After migrating this web site to ASP.NET 2.0 in event viewer start appears
this:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10.05.2006 16:24:07
Event time (UTC): 10.05.2006 14:24:07
Event ID: 6d22d64bd6174ea297a527bf2953c52b
Event sequence: 27
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2040315736/Root-2-127917444735263147
Trust level: Full
Application Virtual Path: /
Application Path: D:\Inetpub\www.luup.com\
Machine name: VINSON
Process information:
Process ID: 5352
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: HttpException
Exception message: Session state is not available in this context.
Request information:
Request URL:
https://www.vinson.com/webresource.axd?d=w8xrHbl9QllPRpFUhORWyw2&t=632775007064853919
Request path: /webresource.axd
User host address: 191.128.1.222
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 23
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Web.HttpApplication.get_Session()
at MyComp.Web.MyCompWeb.Global.SetCulture()
at
MyComp.Web.MyCompWeb.Global.Application_PreRequestHandlerExecute(Object
sender, EventArgs e)
at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
What is the first place /method/ in which is possible to access session in
Global.asax?
Any ideas what other can cause this exception?