Objective 1.4: Configure state management Flashcards
In an ASP.NET MVC 4 application, state information can be stored in the following locations:
■■Cache, which is a memory pool stored on the server and shared across users
■■
Session, which is stored on the server and unique for each user
■■
Cookies, which are stored on the client and passed with each HTTP request to the server
■■
QueryString, which is passed as part of the complete URL string
■■
Context.Items, which is part of the HttpContext and lasts only the lifetime of that request
■■
Profile, which is stored in a database and maintains information across multiple sessions
Caché objects
It is in-process in that although it goes across all users and pages, it is confined to that particular application domain on an individual server.
SessionStateStoreProviderBase
this class enables you to create your own session provider to support situations in which the default session store is inadequate
Cookies
Cookies are small snippets of information stored on the client side and can persist across sessions. They are individualized to a particular domain or subdomain, so with careful planning you can use cookies across a web farm
QueryString
A query string is information that can be used by only one user. Its lifetime is by request unless architected to be managed differently.
How the query string data can be accessed?
You can access the data in the HttpContext.Request.QueryString[“attributeName”] on the server and from the client side by parsing window.location.href.
Context.Items
Context.Items contains information that is available only during a single request. Typically, it is used to add information to the request through the use of an HTTP module in which you can add some information to the request that will be available to the other modules and to the handler.