asp.net 4.0

How to use session state in ASP.NET using C#

Software developer can interact with session state using the  System.Web.SessionState.HttpSessionState class, which is provided in an ASP.NET web page as the built-in Session object. Items can be added to the collection and retrieved after in the same manner as items can be added to a page’s view state:

For example, software developer might store a string in memory like …

Learn more

Label class properties and its descriptions

Web developers can use the Label control to display text in a set location on the page. They can customize the displayed text through the Text property.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)

Property
Description
Supported in .NET version

AccessKey
This property returns or sets the access key that allows software developer to quickly navigate to the Web server control.
1.0,1.1, 2.0, …

Learn more

How to use a SQL server database for state management in ASP.NET

Software developer can instruct ASP.NET to use a SQL database to store session information with option SqlServer: When software developer is going to use this mode, the objects he store in the session state must be serializable. Otherwise ASP.NET will not be able to store the object in the database.

 

<?xml version=”1.0” encoding=”utf-8” ?>
<configuration>
     <system.web>
     <!— other settings are omitted. —>
     <sessionState
        cookieless=”AutoDetect” …

Learn more

How to use a separate Windows service for state management in ASP.NET

Software developer can set ASP.NET to use a separate Windows service for state management with option StateServer: When software developer is going to use this mode, the objects he store in the session state must be serializable. Otherwise ASP.NET will not be able to transmit the object to the state service.

 

<?xml version=”1.0” encoding=”utf-8” ?>
<configuration>
     <system.web>
     <!— other settings are omitted. …

Learn more

WebContol class properties and its descriptions

The WebControl class provides the properties, methods, and events that are common to all controls in the System.Web.UI.WebControls namespace. Web developers can control the appearance and behavior of a Web server control by setting properties defined in this class.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)

Property
Description
Supported in .NET version

AccessKey
This property returns or sets the access key that allows software …

Learn more

How to disable session state management in ASP.NET

Software developer can disable session state management using option “Off”. This can provide a slight performance improvement for websites that are not using session state:

 

<?xml version=”1.0” encoding=”utf-8” ?>
<configuration>
     <system.web>
     <!— other settings are omitted. —>
     <sessionState
        cookieless=”AutoDetect” cookieName=”ASP.NET_SessionID”
        regenerateExpiredSessionID=”false”
        timeout=”20”
        mode=”Off”
        stateConnectionString=”tcpip=127.0.0.1:42424”
        stateNetworkTimeout=”10”
        sqlConnectionString=”data source=127.0.0.1;Integrated …

Learn more

How to configure session state mode by default in ASP.NET

Software developer can configure session state mode by default if he set it to “InProc”. In this case the other two settings have no effect. In this mode the information will be stored in the same process as the ASP.NET worker threads, i.e. software developer will expect best performance, but the least durability. If he restart web server, …

Learn more

How to configure timeout for session state in ASP.NET

Timeout is important session state setting in the web.config file. It specifies the number of minutes that ASP.NET will wait, without receiving a request, before it abandons the session.

 

<?xml version=”1.0” encoding=”utf-8” ?>
<configuration>
     <system.web>
     <!— other settings are omitted. —>
     <sessionState
        cookieless=”AutoDetect” cookieName=”ASP.NET_SessionID”
        regenerateExpiredSessionID=”false”
        timeout=”20”
        mode=”InProc”
        stateConnectionString=”tcpip=127.0.0.1:42424”
        stateNetworkTimeout=”10”
        sqlConnectionString=”data source=127.0.0.1;Integrated Security=SSPI”
        sqlCommandTimeout=”30” allowCustomSqlDatabase=”false”
        customProvider=””
     />
     </system.web>
</configuration>

 

This parameter is one of the most important, because a difference of minutes can have an impressive …

Learn more

How to configure session state to use AutoDetect in ASP.NET

Software developer can configure session state through web.config file for his current application (which is found in the same virtual directory as the .aspx web page files).  UseDeviceProfile is the one of possible modes for HttpCookieMode. When this mode is set ASP.NET attempts to determine whether the browser supports cookies by attempting to set and retrieve a cookie. …

Learn more

How to configure session state to UseDeviceProfile in ASP.NET

Software developer can configure session state through web.config file for his current application (which is found in the same virtual directory as the .aspx web page files).  UseDeviceProfile is the one of possible modes for HttpCookieMode. When this mode is set ASP.NET chooses to use cookieless sessions by examining the BrowserCapabilities object. The drawback is that this object …

Learn more