- Application State and Session State are the two Server-side State Management options available in ASP.NET
- Page.Application is of type HttpApplicationState.
- Request for an ASP.NET page is processed by ISAPI (Internet Server Application Programming Interface).
- ApplicationManager is an AppDomain that manages all the execution for a single ASP.NET application (including global variables).
- HostingEnvironment class allows access to resources (such as files and directories) inside a hosting environment.
- HttpContext, HttpRequest and HttpResponse are the core objects used to process any ASP.NET page request.
- Application is started by using (or re-using an existing) an Instance of HttpApplication. When this instance is created objects/modules such as SessionStateModule also get loaded.
- This Application object serves as the pipeline for all application execution.
- An Application can have one instance of Global.asax (Global Application Class)
- Application_LogRequest event is fired when a request is made to the Application.
- Since Application object can be accessed by more than one page (running on different threads) at the same time, its always a safe practice to use Application.Lock( ) before altering any Application State values.
- Application object is a collection with members of type object, therefore boxing is required.
- Session state is scoped only to current browser/user and only available to that session.
- Session object is of type HttpSessionState.
- ASP.NET_SessionId is a cookie containing a 24-byte value to keep track of session.
- Setting SessionState mode property to OFF in Web.config would improve performace.
- Values stored in Session must be serializable.
- Page directive also contains an attribute to enable/disable session state for individual pages. This can also be set to ReadOnly.
- Sessions can be configured to be Cookieless.
- ASP.NET would raise Session_End event only when state mode is set to InProc.
- InProc mode keeps session data in server memory and is the default state mode.
- StateServer hands over state data to ASP.NET State Service which preserves data between Application startups and multiple servers. This Service is present on all IIS Servers but set to manually start by default. To use it we must set its startup to Automatic.
- SQL Server also preserves session state data but on SQL Server database. It also requires connection string in web.config when configured for use.
- Profile properties are also scoped to current user.
- However, Profile properties are always persisted in SQL Server database (and not in server memory)
- Also, values stored in these profiles can be strongly typed objects.
Sunday, October 4, 2009
Chapter 4-Lesson 2
Labels:
AppDomain,
Application,
Global.asax,
InProc,
ISAPI,
Profile Properties,
Server-side state,
Session
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment