Monday, January 18, 2010

How to control session ID in ASP.Net?

Give me any source of this tutorial.How to control session ID in ASP.Net?
ASP Sessions Are Cookie-based


ASP uses HTTP cookies to send users their unique session keys. For example, an ASP application that is using sessions would respond to a user's request with an HTTP header such as:





Copy Code


Set-Cookie: ASPSESSIONID=PUYQGHUMEAAJPUYL; path=/Webapp


Each subsequent request by this browser to this server, in the virtual directory /Webapp, would include the HTTP cookie header:





Copy Code


Cookie: ASPSESSIONID=PUYQGHUMEAAJPUYL


ASP automatically processes this cookie and uses it to restore the values saved in the Session object. The cookie that is sent by ASP as a session ID does not provide an expiration time. Cookies with no expiration specified are only valid until the browser is closed. In this way the cookie is flushed when the user exits the browser.





Managing ASP Sessions


The server will maintain a user's session data for the lifetime of the session. A script can end a session programmatically by calling the Abandon method of the Session object. When a user completes an application and a session is no longer needed, the script can simply call Session.Abandon to end the session and free the server resources used by that session. A session can also end if the user does not make any HTTP requests to the ASP application for a specified time-out period. This period defaults to 20 minutes, but can be adjusted by setting the Timeout property of the Session object. If a user begins a session, but stops making requests to the Web application, ASP will time out the session after the specified idle period expires. The Session object also exposes a SessionID property. SessionID is a LONG datatype that uniquely identifies the user session.





Session Events


ASP also provides session-specific events that can trigger your own session initialization and clean up code. Each time a new session begins, the procedure Session_OnStart is called. An ASP program can use this event to perform any required session initialization tasks. Any time a session ends, whether it was timed out by the server, or killed by calling Session.Abandon, the procedure Session_OnEnd is called. An ASP program can use this event to perform any session cleanup that is required.














The ';SessionId in the URL'; thing is called ';cookieless sessions'; and there are a few gotchas: relative paths don't work and there is a separate timeout value to minimize session-hijacking





So, if you uses Froms authentication check the timeout attribute setting in both environments.





Or maybe the QA server uses a different site-map ?





It would be helpfull to know how the ';Exit'; on Page B is implemented.How to control session ID in ASP.Net?
In ASP.NET, you're not so much interested in the Session ID as you are in the ViewState.





http://quickstarts.asp.net/QuickStartv20鈥?/a>

No comments:

Post a Comment