asp.net - Why is HttpContext.Session null when redirectMode = ResponseRewrite -


As suggested, I am using redirectMode = ResponseRewrite in my custom error configuration so that my custom error page Could use exception information. It has worked like a charm for some time.

Adding something else helps users overcome the functionality of "user error" type, we already need a piece of information stored in the session. When it is implemented, I found that many paths for the session end in zero, when there are redirectMode = ResponseRewrite, but they are all populated when redirectMode = ResponseRedirect (or not defined).

Why do anyone know? It seems weird that we have to make the selection between exception response (ResponseWeight) or session (Response Redirect).

Rich custom error handling tells me that the session is available only when the control passing method server The transfer, which I assumed the presentation Rewart according to the notion. Obviously this is not the case.

I still do not know the answer to the question, but to get it, I used to do my web configuration Took the redirection mode and inserted custom logic into the Global.assx Application_Error handler which I wanted. I am altering the exception with a "user friendly" message exception, but the transfer argument is basically:

if (context.IsCustomErrorEnabled)


Server.Transfer ("/Error.aspx");
}

Error then. Page to load error from context in page, there is page_load code and display message.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -