Sep 27, 2013

how to Turn off Session State From our Asp.net website

Since ASP.NET Session State is on by default, you pay the cost in memory even if you don't use it. If you're not using Session State, turn it off and save yourself the overhead. There are serveral ways to do this:
  1. If you're not using Session State at all, turn it off completely via web.config file:

    <system.web>
        <sessionState mode="Off"></sessionState>
        ...
  2. If you're using Session State, but it's required only for a few pages, then first turn it off for all pages:

    <system.web>
        <pages enableSessionState="false">
        ...

    then enable it for a specific page:

    <%@ Page ... EnableSessionState="true" %>

 obviously such optimization makes sense only for high-traffic web sites. example :Irctc.co.in

No comments:

Post a Comment