How do you handle session management in ASP.NET and How do
you implement them. How do you handle in case of SQLServer mode?

Answer Posted / venugopal

ASP.NET session state enables you to store and retrieve
values for a user as the user navigates ASP.NET pages in a
Web application. HTTP is a stateless protocol. This means
that a Web server treats each HTTP request for a page as an
independent request. The server retains no knowledge of
variable values that were used during previous requests.
ASP.NET session state identifies requests from the same
browser during a limited time window as a session, and
provides a way to persist variable values for the duration
of that session. By default, ASP.NET session state is
enabled for all ASP.NET applications.

We can create the session in Asp.Net is as fallows..

Session["FirstName"] = "venugopal";

In case of Sqlserver session stage we will use the
web.config

In web.config we wills store the session like as fallows

<sessionState
mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user
id=username;password=password"
cookieless="false"
timeout="20" />

Remember that the element names and attributes are case-
sensitive.

This is the most reliable since it's disconnected from the
Web server. This option uses the sqlConnectionString
option. The connection string follows the normal syntax for
connecting to a SQL Server database.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define page fragment caching?

528


What is enableviewstatemac in asp net?

599


When using the Pager object, inorder to know which page to go, which property you have to set to grid?

567


What is the maximum number of classes that can be contained in one dll file?

685


Give a few examples of page life cycle events.

676






Explain the basic functionality of garbage collector?

532


What is asp.net mvc5? : Asp.Net MVC

541


benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks

1778


What are Master Pages in ASP.NET? or What is a Master Page?

613


What do you understand from custom control?

613


What is sdlc process?

530


Explain Authentication mechanism in dotnet

633


What is the question mark in a url?

526


What is intrinsic objects in asp.net?

649


What is a 307 redirect?

512