Session variables lost after a redirect page

Hi all ,

I have encounter a session variable lost after a redirect page when i set the cookiesless=false in web.config. This happen when u i tried to access the application from another pc while my application reside in another web server.

therefore in order to solve this problem i tried to change in the web.config file by setting the cookieless =true than it works.

<sessionState mode="InProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes" cookieless="true" timeout="20"/>

how can i have this problem and enable my web server to enable to accept cookies. i have tried several methods below but it does not work.

1) In internet options , under privacy tab in Advanced Tab , i check the options for the overwrite automatic cookie handling and check the accept first party and thrid party cookie.

2) in IIS i have set the check enable session state


5/5/2005 1:40:49 AM 91979 articles. 4 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 58
Get it on Google Play
Get it on Apple App Store

When you are using cookieless sessions, the session id is sent from the browser using the URL's querystring.  So, if you are doing a redirect then  make sure you are building the URL for the redirect properly, it has to include the variable for the session id.  Have a look in the documentation for HttpResponse.ApplyAppPathModifier.

BTW, if you are using "InProc" as the SessionState mode, then you don't need to specify any connection strings.



"Be as smart as you can, but remember that it is always better to be wise than to be smart."

Alan Alda
5/5/2005 3:56:08 AM
Hello, when using cookieless sessions, make sure when you do a redirect
use links like "../main" or "~/main" so that you won't be generating a
new request with a new SessionID.


Bilal Hadiar, MCP, MCTS, MCPD, MCT
Microsoft MVP - Telerik MVP
5/5/2005 7:59:17 AM

Similar Artilces:

Last variables stored in Session get lost when redirecting to _target page.
 We have a session object that holds certain data - on our last panel of our panel wizard we ask two questions: checkbox :  Use pre-printed paper?radioBox:  Most recent test                    All past tests we save those two variables to our session like several other variables that we have saved. This then Redirects to a _target page that builds our report.  HOWEVER, alot of the time (AND NOT ALWAYS) these last two variables do not get populated to our session?  If I debug and...

Session Variables getting lost
Hi I have a Parent Page called Parent.aspx in which i have a Grid View which has a column in which button is placed from which i am opening a Pop Up Window(Page) named Child.aspx. Before opening th pop up i assigning a DataTable to a Session variable so that i can access the DataTable in Child.aspx which can be accessed.Now I have created the 2nd DataTable in Parent.aspx for which the rows are added in the child.aspx page. The 2nd DataTable need to maintain all the rows which are added in child.aspx page. but unfortunately i am not getting  the DataTable from the Session .If i make...

Session variable lost in redirect
I am having a problem with loosing a session variable after I redirect to another page. Here is my code:login.aspx: if(sAuthorized != "-1" && sAuthorized != "-2") { Session["user"] = sAuthorized; Response.Redirect("index.aspx"); }index.aspx:private void Page_Load(object sender, System.EventArgs e) {    CheckLogin();    string sUserID = Session["user"].ToString();    DataSet ds = SqlHelper.ExecuteDataset(DataAccessLayer.ULTConn(), "sp_get_users_courses",    new SqlParameter("@user", SqlDbType.VarChar, 20).Value = ...

session variable gets lost
Hi! I have a session variable, and I set the Session.timeout=120; but after a while (not even 30 mins )it got lost and had errors cause of that in the app_code, where I have a function that takes as parameter the session variable value. Thank for any advice. Firstly make sure you are never overwriting the session variable.Another thing would be if the web server is low on resources it may drop some session items.  Make sure in the web.config file the session timeout is set properly     <sessionState timeout="120"/>Check below link for more info ht...

Getting things back in Start Page and things out of Start Page
I know I posted over a year ago about this same question, I can not find my original post though. I know I posted it and I did find the solution and posted the sollution but I can not find it anywhere here again. They really need a better search engine on these forums. Is there any tools out there to help manage the start page? For example. I have projects that are on a web server I access them on the remote server. Well the start page never ever shows any updates for it the date posted as last access is the day I created it, However this is one of my more used projects. This one is so b...

ColdFusion Session Variables Getting Lost
Name: Randy Email: randyatgetsetdotcom Product: Firefox Release Candidate Summary: ColdFusion Session Variables Getting Lost Comments: I am a ColdFusion Programmer and just downloaded Firefox 3.0. Twice in the last twenty four hours my ColdFusion session variables have suddenly disappeared. It is possible they timed out. They have a two hour limit set but typically they persist two hours from last use it is possible they are timing out two hours from their creation. Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9) Gecko/2008051202 Firefox/3.0 ...

Session variable value gets lost
I am using 3.0 with C#. My web application requires some values that is used across my User Controls. These values are pertaining to the login user name and User type. When each user is logged in I store that username and user type in a session variable and whenever i need to used it like in a query I just called the string variable that is assigned to the Session variable. My problem is sometimes my session object/ string variable loses its value and I am wondering is there another way of storing my User's credential so that the value will not be lost until the User closes his/h...

Session variables lost between page requests
Hi We're getting a problem where session variables are lost between page requests. I set a session variable (affilaite id) when a session starts in session_start event in global.asax. With tracing enabled i can see that this variable is resident on the initial page request. When i navigate to a new page however, all session variables are lost. This has only just started happening fairly recently and I cannot find any particular piece of code that may be causing it. I've read stuff on the web about worker process recycling but if this is happening every time the user requests a page then so...

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 ...

Redirecting the page but getting the same page again
I have a button and on click event i have written response.redirect to another page but i run this page, click on that button, same page opens.When i have tried to open another page directly but still the same page opens where i put the button. I m not getting what is happening.Can anybody help me.Web DeveloperPune,India Can you paste the code! thanksMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets smartymca:I have a button and on click event i have written response.redirect to another page but i run this page, click on that but...

I wrote code Response.Redirect then page is not redirected to reqquested page (
I wrote code Response.Redirect then page is not redirected to reqquested page  (with make sure that your target URL is valied and correct... or the problem might be from your browserRegards...Nassar, RamiMy Blog || E-Mail Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. dear, just paste the code so that we can assist u accordinglyKind Regards,Saurabh Sharmaonly dead fish swim along the flow of river, learn to make yo...

Session Data Lost when i redirect to another page
Hi all, I can't find the solution why my session data was lost when i redirect to another page.In my authentication page, i store the user id in session.Session["UserID"] = this.txtuserId.Text; .............. Response.Redirect("Home.aspx", false); but when i check in home.aspx, my session data was lost. Can anybody solve this problem. regards,gakuci  Hi,Are you using Session.Abandon() or Session = null anywhere in the code?Vivek Social Networking Platform in ASP.NET || Join now: CodeASP.NET Community Please mark the most helpful reply/replies as &quo...

Query string and session variables lost after redirect
Hi, I'm trying to redirect a user form one application to another by using response.redirect(). I need to pass a returnURL so I'm doing this through a query string: In myapp1 I call: Response.redirect(http://localhost/myapp2/logon.aspx?ReturnUrl=, true) When debugging the myapp2, in page_load of logon.aspx.cs I've lost the query string AND some session variables I stored. The session ID is the same.... Any idea? Any configuration to be set in web.config? Thanks a lot, Claudio...

Redirect to login page when session get timeout
 in my website, i need to redirect to login page when session get timeout.....Please advise on this...i have followed some ways..1. Checked every page pageload event the value of session is null or not..  but i used session variable in aspx page.. so i get exception before the page load.... how to handle this............ thanks in advance CheersFlorenceMy Blog Hi, Try using the Session_End() event in the Global.asax page. You can direct to ur login page in this event. Cheers

Web resources about - Session variables lost after a redirect page -

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 ...

Cisco Debuts Open Pay Variable Pricing, Updates CCRE
Cisco Debuts Open Pay Variable Pricing, Updates CCRE Channel Partners Kris Snow, president of Cisco Capital, says the company's new Open Pay ...

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: 11/25/2015 5:53:59 PM