Why / when is session recording vulnerable to terminating a thread?

CODE:

Session["foo"] = "bar";  
Response.Redirect("foo.aspx");

PROBLEM:

When foo.aspx reads "foo" from a session, it does not exist. There is a session, but no value for "foo".

I observed this intermittently in our production environment. But I do not want to ask a question about Response.Redirect () here .

EXPLANATION:

Bertrand Le Roy explains (my bold):

Now, what Redirect does is send a special header for the client so that it requests a server for something other than the one that it was expecting. On the server side, after sending the header, the redirect completes the response. This is a very cruel thing. Response.End actually stops the execution of the page, wherever it is using the ThreadAbortException. What really is happening here is that the session token is lost in the battle.

My takeaway is that Response.Redirect () can be heavy with end threads. And it can threaten my session if they are too close to this hard work.

QUESTION:

ASP.NET ? Response.Redirect() , - ?

, ? , ( ) ?

+5
3

(Response.Redirect(..., false), Server.Transfer() "", ), .

InProc SqlServer , Response.Redirect(...) . , , , : SqlServer ( " InProc" ? ).

+1

, , , cookie . , ThreadAbortExceptions , , .

Response.Redirect() , , , .

Response.Redirect(string url,  bool endResponse);

endResponse, "false", , , Thread.Abort() . , , , .

Response.Redirect(url, false), Application.CompleteRequest(). , .

+2

, . (, ) .

0

All Articles