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

What is Cookies Less Session?

610


How can we use Web API with ASP.NET Web Form?

646


Difference between DataGid and Girdview? Difference b/w .Net 2.0, 3.0 and 3.5 ? Diff b/w dispose & Finialize Methods?

2024


If 200 is for all successful operation then why do we have 201 response codes?

524


Explain about solution explorer window?

615






Which property is used to identify the Page is Post Back in ASP.NET?

554


How can I open ashx file in mobile?

617


What is an asp.net web form?

627


What is globalization and localization in asp net?

489


How u refer webservices?

1492


What is the function of the ViewState property?

634


How do you implement sql caching in asp.net?

561


Is it possible to write code in many languages in one asp.net project?

556


What is a postback url?

491


What are the Types of object in asp

633