Losing session variables after response.redirect

I'm using StateServer to manage my sessions.

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:1702" />

I then set the session values as follows on one page:

Session("UserID") = dbReader("UserID")
Session("FirstName") = dbReader("FirstName")
Response.Redirect("~/member/Default.aspx")

When it redirects to the next page, the session values are blank (null). I'm not sure at all what's happening. The IIS settings are fine as well.

XP Pro, ASP.NET 2.0, IIS 5.

0
samofny
8/9/2006 2:25:14 AM
asp.net.state-management 8807 articles. 0 followers. Follow

2 Replies
1746 Views

Similar Articles

[PageSpeed] 5

There are too many protential reasons for session loss, and here is a newly post article on this, which I think convered much, hope it helps. And as your is personal computer, I recommend you check if you are using a anti-virus soft and it's scanning your site all the time, I've occasionally met this problem before(thought I use default "InProc"), when I turn my virus scan off, session goes right~


你好! Just FYI o_O
0
Gordon
8/10/2006 9:30:59 AM

I've also tried InProc and still have the problem of losing the session variable values. This is my latest code in web.config.

<

sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="20" />
0
samofny
8/17/2006 2:16:34 AM
Reply:

Similar Artilces:

How to Debug Response.Redirect losing session variable, when upload file
HELP! I have a page where users can enter text and optionally upload an image. To upload the image, the page contains an image file upload usercontrol I created. The control displays the image after loading and stores the image information to the database and creates an image ID. Then the user can submit the entire page which just saves the user's text and the image ID to the database. In addition, I create a user account for the user and store their new id in a session variable ("LoginID"). When saved, the page does a response.redirect to the next data input page. Excluding the first pag...

Response.Redirect with Session Variable vs. Global Variable -- Best Practices?
Hi,I have a simple contact form and when the user presses the submit button an email is sent and  I have a response.redirect to "emailSent.aspx" where it says "Your request has been received....etc.".  I have the submit button in a try/catch block.  What I want to do is a "emailFailed.aspx" where it says "Email problem, etc." but I also want to carry over the ex.message text.  I want to pass the ex.error text to the "emailFailed.aspx" page so on pageLoad I can have a label with something like:labelMessage.Text = "There was a problem with your email.  The error is " +...

Losing Session variables/state?
I'm having regular issues with the ASP.NET 2.0 Sessions. The session variables work fine for the most part. I found, downloaded and installed a Session timeout control which is intended to resend the user to the login page when the session timeout is reached. This does work but I'm not sure how well. The control is installed on various Master Pages.  The problem is that from time to time I get an Object reference not set to an instance of an object error:if (DetailsView1.CurrentMode == DetailsViewMode.ReadOnly) { string session = Session["client_id"].ToString(); DetailsView1.F...

Session Variables lost after Response.Redirect()
Hi gurus,  I encouter lost session variables trouble when Response.Redirect() to another aspx page. I set 19 Session variables before redirecting. However, the redirected page's session contains only One variable. The very weir sympton is: If I restart IIS, only for the first IE encounter, the redirected page DOES show all 19 session variables.Once I close IE, any further IE or IE from any other machine's only shows ONE session variable. I can also reproduce such symptons in VS2005 development environment. Can someone tell me what I have missed?   Thanks! Here is ...

Response.redirect loses session info
Hi - I am running a site which checks available slots on a normal asp.net web site, and then if the user wants to book a slot, redirects them to a page behind SSL where they can enter their Credit Card details. I use response.redirect to take them to the SSL page (as server.transfer will not show them the padlock etc - so I think this may put people off entering those details) - and I store the information the person was looking for in a session variable. However, when I response.redirect, the session loses it's information. Is it correct that sessions only exist in the same applica...

Session State variable missing after Redirect
When an error occurs, I set a session variable so that after redirecting to an error page, a detailed explanation can appear.  The variable (a string) is gone by the time I reach Page_Load in the target page.  I've checked and it is the same session ID. Any ideas? Are Sessions enabled? Are you forwarding to a page outside of you application?View My Blog Download My URL Rewriter and Reverse ProxyOnly $9.95/month, ASP.NET, 2GB & SQL 2005...

State management upon session variable changes
I noticed that whenever a session variable is changed...the application knows about it and suddenly restarts session. My question is does restart "ALL" sessions or only the active sessions for which the variables changed? Imagine a "multi-user" application all with different states and an administration panel that lets you change session variables.  In this case, my question has to do with the question that if Company X changes his session variables, will only Company X's sessions be reset or will all "sessions" be reset?  Hope that makes sense. ...

session variable gets empty after response.redirect
 Hi,I am not getting why following things happening.. 1. I have declared session variable in global.asax2. Session("postrentattempt") = ""3. In the page load of post rent page I am writing           Session("postrentattempt") = "1"            Response.Redirect("sellerlogin.aspx")  4. Now, in sellerlogin, I am checking if             Session("postrentattempt") =...

losing Session Values with Response.Redirect(NewPath, False)
 Hi All,  I noticed you responded to a similar post to the problem I am having. Basically I have built my own URL rewritting app that accepts a url such as http://www.someserver/com/mypage.aspx?editmode=true an based on this it does some checks (In On Application_beginrequest or global.asax) to see if the user should be logged in or not to access the page. If the user does need to be logged in, it will automatically redirect them to the login page and request that they log in.The trouble I'm having is that on the login.aspx when the user logs in and their credential...

Session variables vs. Session States
What is the difference and in what situations are they used. Thanks, Mattypee A session state (the state of your session) holds your session variables. If your session state expires (due to inactivity) then you lose your session variables...and any other info stored for that session. If you need to store USER specific information within a web app, then session variables are one(of several) ways to do it. MajorCatsMajorCats Is there any code that you could show that would give an example? Thanks, Mattypee example of what? reading and writing session variables? ...

Opinions on Viewstate vs. Session variable for state management on dataset
I came across many sample codes that using ViewState(myDataSet) and Session("myDataSet"). Which is a better way to use to keep the session around. What are the pros and cons? Anybody can share with your experience or thoughts? Thanks, teresa Take a loot at this article: State Management in Web Forms http://www.c-sharpcorner.com/Code/2004/Feb/StateManagementInWebForms.aspDarrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...

Losing session variables when using redirect to new web page
Hi All   I have an application which involves a sign up process where i store details filled in separate screens in session variables  movement between pages is by clicking on a button which redirects user to next page, all because i though button looked neater plus at least 1 screen uses a button in a datagrid for navigation Its being behaving erratically for a while, finally i was updating whole site an discovered that most of the time session variable are wiped out I guess this tells me one reason why the websites sign up rate is abysmal   I found another thread abo...

Session State Variables across multi sessions
I am having an issue where I save my DataTable into a Session Variable:   Session["dtDMFile"] = dtDMFile; Different users can use the web form that I created. Once the data is loaded,I send the DataTable to the session variable. My problem is that when I go to reload the data in the table, it is taking the data from the last user who stored the DataTable instead of from the particular user on their browser. For instance, User 1 (machine 1) loads data with field contents of: field1  field2  field3 User 2 (machine 2), then loads data with field contents of: f...

getting a new session id and losing session variables
prb: I have two pages in my app - one on redirect and the other as a new window - that get a new session id from every other page in the app (they both get the same session id) and obviously the session state variables are lost and, therefore, the pages do not look like they should.  All pages are within the same domain and virtual directory. 1. a redirect; session variables are lost; session id is different from the previous page; if you click the BACK button you return to the previous page and the session id is the same as before and the session variables are as they should be2. ...

Web resources about - Losing session variables after response.redirect - asp.net.state-management

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

YouTube v10.32 Tweaks Some Interface Elements And Includes Hints About Virtual Reality Content And Variable ...
Forget Update Wednesday! Monday is the new big day. Not only were we treated to the latest M preview release and the official Marshmallow name, ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

Expert Reveals the Latest Variable Capacity Technology
Learn about gForce Ultra CRAC equipment, the latest variable capacity technology to lower energy usage and increase reliability.

Resources last updated: 1/8/2016 9:03:46 AM