Session
1. What is the difference between Session.Abandon() and Session.Clear()?
The major difference is that if you call Session.Abandon(), Session_End will be fired (for InProc mode), and in the next request, Session_Start will be fired. Session.Clear( ) just clears the session data without killing it.
2. Explain Session.Abandon()
Session.Abandon(), explicitly ending a user session. If a user requests a new page after the Abandon method is called, he or she is treated as a new user. The user is assigned a new session ID and all the items in session state previously associated with that user are removed from memory. The Abandon method is often used with sign-out pages.
3. Different Modes of Session States
Storing Session State In Process
Storing Session State In Windows Service
Storing Session State In Database Table
4. Explain Advantage and disadvantage Storing Session State In Process
Advantages:
By default, session state are stored in process. The advantage of storing session state in process is performance. You can store and retrieve items much faster in session state.
DisAdvantages:
1) If, for whatever reason, the server crashes, you lose all data stored in session state. You lose session data when an ASP.NET application is reloaded for any reason.
2) If session state is stored in process, session state cannot be shared across multiple servers. Storing session state in process limits the scalability of your Web site because you cannot configure multiple servers to handle requests. In other words, storing session state in process is incompatible with Web farms.
5. Explain Advantage and disadvantage Storing Session State In Windows Service
Advantages:
1) Crashes of ASP.net will not destroy session information.
2) It is compatible with Web Farms scenario.
DisAdvantages:
Reading and writing session state is slower than Session state In Process.
6. Explain Advantage and disadvantage Storing Session State In Database Table
Advantages:
1) Crashes of ASP.net will not destroy session information.
2) It is compatible with Web Farms scenario.
3) The advantage of this approach is that you can cluster multiple database servers so that if one server fails, another database server can take over the state management.
DisAdvantages:
Reading and writing session state is slower than Session state In Process.
7. Response.Redirect and Server.Transfer is not working in Session_End?
Session_End is fired internally by the server, based on an internal timer. And thus there is no HttpRequest associted when that happens. That is why Response.Redirect or Server.Transfer does not make sense and will not work.
8. Is the session Timeout attribute a sliding timeout value?
The session Timeout is a sliding expiration time, meaning whatever your page access session state, the expiration time will be moved forward.
9. Is the session timeout attribute in minutes or seconds?
The Timeout setting is in minutes, not in seconds. i.e The timeout attribute specifies the number of minutes a session can be idle before it is abandoned. The default is 20
10. Can I share session state between ASP.NET and ASP pages?
No.
0 Response to "Session"
Post a Comment