Monday, 25 August 2014

How To Disable ASP Session State in ASP.NET?



Disable Session State at the Application Level
The following steps to disable session state at the Application level:

a)       Start Microsoft Visual Studio .NET, and create a new ASP.NET Web Application.
b)       In Solution Explorer, double-click Web.config to view the contents of this file.
c)       Locate the <sessionState> section, and set the mode value to off.
d)       Save the file and/or the project to disable session state throughout all pages in the application.
Disable Session State at the Page Level
The following steps to disable session state at the Page level:

a)       Start Microsoft Visual Studio .NET, and create a new ASP.NET Web Application.
b)       In Solution Explorer, double-click the Web Form for which you want to disable session state.
c)       Click the HTML tab.
d)       At the top of the page, add EnableSessionState="false" in the @ Page directive. The modified attribute should appear similar to the following:
e)       <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
f)        AutoEventWireup="false" Inherits="WebApplication1.WebForm1"
g)       EnableSessionState="false" %>

h)       Save the file and/or project to disable session state throughout all pages in the application.

No comments:

Post a Comment