Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3422860
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:17:30+00:00 2026-05-18T06:17:30+00:00

THE CODE: Session[foo] = bar; Response.Redirect(foo.aspx); THE PROBLEM: When foo.aspx reads foo from the

  • 0

THE CODE:

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

THE PROBLEM:

When foo.aspx reads “foo” from the session, it’s not there. The session is there, but there’s no value for “foo”.

I’ve observed this intermittently in our production environment. But I don’t mean here to ask a question about Response.Redirect().

THE EXPLANATION:

Bertrand Le Roy explains (the bolding is mine):

Now, what Redirect does is to send a
special header to the client so that
it asks the server for a different
page than the one it was waiting for.
Server-side, after sending this
header, Redirect ends the response.
This is a very violent thing to do.
Response.End actually stops the
execution of the page wherever it is
using a ThreadAbortException. What
happens really here is that the
session token gets lost in the battle.

My takeaway there is that Response.Redirect() can be heavy-handed with ending threads. And that can threaten my session writes if they occur too near that heavy-handedness.

THE QUESTION:

What about ASP.NET session management makes it so vulnerable to this? The Response.Redirect() line of code doesn’t begin its execution until the session write line is “finished” — how can it be such a threat to my session write?

What about the session write doesn’t “finish” before the next line of code executes? Are there other scenarios in which session writes are similarly (as though they never occurred) lost?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:17:31+00:00Added an answer on May 18, 2026 at 6:17 am

    After testing several alternatives (Response.Redirect(…, false), Server.Transfer(), and other “solutions” I can’t now recall), we’ve found only one reliable answer to this problem.

    Moving our session state from InProc to SqlServer effectively eradicated this behavior from our systems, leaving Response.Redirect(…) completely reliable. If further testing shows otherwise, I’ll report here, but I say, to make this stop happening in your environment: move your session state into SqlServer (or is “out of InProc” good enough? I’m not sure).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to keep viewstate of a specific page in session but following code
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
As per my understanding stateless session beans are used to code the business logic.
I am writing PHP code where I want to pass the session id myself
Code I have: cell_val = CStr(Nz(fld.value, )) Dim iter As Long For iter =
Code below is not working as expected to detect if it is in design
I have these entities class Foo{ Set<Bar> bars; } class Bar{ Foo parent; String
Hi i'm getting an error when using this code Session(formatdate) = Left(drv.Row(booking_status), 10) Session(formatdate).ToString(dd-MMM-yyyy)
The title may be not exactly, but I don't know how to express it.
I'm in the process of porting some code from Linux to Mac OS X.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.