Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Client- and Server-side Solutions to Managing State in ASP.NET : Page 9

Whether you are building a traditional Windows application or a Web-based application, state is what an application knows about the user, their current interaction with the application, and other pieces of global information. Get a full assessment of the best techniques for managing state.


advertisement
Disabling Session State
 
Figure 5: You can enable or disable session state for a page with the enableSessionState property.
Session state is enabled for all pages in an application by default. You can sometimes improve performance by disabling session state for pages that do not need to use it. To do this you disable page session state by setting enableSessionState to False in the page directive like this.

<%@ Page Language="vb" EnableSessionState="False" %>

You can also set enableSessionState to False in the Property sheet for the page (see Figure 5).

You can choose to disable session state for the entire application by setting sessionState mode = Off in the Web.config file.

<sessionState mode="Off" stateConnectionString= "tcpip=127.0.0.1:42424" sqlConnectionString="data source=(local); Integrated Security=SSPI" cookieless="false" timeout="20" />

Server-Side Method State Management Summary
Table 3 recaps the server-side management techniques available to you and when you should consider them.

Table 3: The server-side state techniques and when to use them.



Mode

When to Use

Application State

Use when data is fairly static and needs to be available to all users on a site.

Session State

Use when storing limited amounts of information specific to an individual user's session .

Database

Use when you are storing large amounts of data or the data must survive application, session, database, or machine restarts.




Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date