Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session is not available in Application_Error?

Status
Not open for further replies.
The way your session is setup might make a difference (inProc, state server, sql). Not sure if it will matter or not in your issue, but with others I have ran into it had.
 
I agree, did you see any MS docs on it?

my web.config had:

<sessionState mode="InProc" />

<customErrors
defaultRedirect="Error.aspx"
mode="On"
/>
 
I keep this in my Global.asax.cs
Code:
protected void Application_Error(Object sender, EventArgs e)
{
	if (Server.GetLastError() is HttpUnhandledException)
	{
		Exception ex = Server.GetLastError();
		SkillException UHException = new SkillException();
		string s_UHAppError = ex.InnerException.Message.ToString();
		UHException.LogExceptions(s_UHAppError);
	Server.Transfer("~/errorpage.aspx");
	}
}
I pass it to my on Exception Handler and write it to a logfile before I transfer.
Marty
 
Thanks Marty,

There is no problem to log Server.GetLastError() in Application_Error, all info is there, the problem is that MS claims you could save it in a Session variable!
 
kneejnick:
OK, I did not understand the post. I find it interesting and am going to read the link you posted better.
Thank you,
Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top