Enabling and Disabling Session in asp.net:


For performance optimization we can enable or disable session. because each and every page read and write access of the page, and this involves some performance overhead. So its always better to enable and disable session based on requirements rather than make it enable always. we can  enable and disable the session State in two ways: 
  • Page Level 
  • Application Level  
Page Level :
we can disable session state in page level using EnableSessionState attributes with in Page directive. 
This will disable the session activities for that particular page
Same way we can make it read only also , It will permit to access session data, but it will not allow writing data on session. 
Application Level : 
Session state can be disabled for all over the web application using EnableSessionState property inWeb.Config .
Generally we are use Page level, because some of page may not require any session data or may be only read the session data.

0 comments:

Post a Comment