Passing data from Global.asax to a generic errorpage.

K

kurt sune

I have a generic errorhandler in global.asax.
(in Application_Error)

I need to transfer an error string from global asax to a generic error page.

So I try: this code with the thought of picking up the string from session
an Error.aspx.

1 Dim errorString As String = "the whole error string"
2 Try
3 Session("Error") = errorString
4 Response.Redirect("Error.aspx")

But sometimes I get error on row 4: "Session state is not available in this
context."

Isn't Session always available in Global.asax? (it works sometimes)

Do you have a better idea of how to transfer large text from global asax to
a generic error page?


/k
 
K

kurt sune

1 Dim errorString As String = "the whole error string"
2 Try
3 HttpContext.Current.Session("Error") = errorString
4 Response.Redirect("Error.aspx")

gives me: "Object reference not set to an instance of an object." on row
3.

/k
 
J

Just Me

This is not on a spawned thread is it, Async calls ?

If it is, I dont know a way around it because ive seen it before and dont
know the cure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top