Questions tagged [session-state]

Session-state allows the retrieval of values for a given user as that user navigates through a website. It is used to maintain state across a visit within the constraints of the stateless HTTP protocol. Session-state is commonly abbreviated to session.

ASP.NET session state supports several different storage options for session data. Each option is identified by a value in the SessionStateMode enumeration. The following list describes the available session state modes:

  • InProc mode, which stores session state in memory on the Web server. This is the default.
  • StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
  • SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
  • Custom mode, which enables you to specify a custom storage provider.
  • Off mode, which disables session state.

You can specify which mode you want ASP.NET session state to use by assigning a SessionStateMode enumeration values to the mode attribute of the sessionState element in your application's Web.config file. Modes other than InProc and Off require additional parameters, such as connection-string values as discussed later in this topic. You can view the currently selected session state by accessing the value of the HttpSessionState.Mode property.

Check more details in the follow link - Session-State Modes

1902 questions
630
votes
15 answers

If REST applications are supposed to be stateless, how do you manage sessions?

I'm in need of some clarification. I've been reading about REST, and building RESTful applications. According to wikipedia, REST itself is defined to be Representational State Transfer. I therefore don't understand all this stateless gobbledeygook…
Zak
  • 24,947
  • 11
  • 38
  • 68
147
votes
10 answers

Unable to make the session state request to the session state server

Our site is currently having this problem. Basically it only happen when we click some particular links where it will pop-up a new window. This is the error message we receive : Unable to make the session state request to the session state server. …
Adi
122
votes
4 answers

In ASP.NET, when should I use Session.Clear() rather than Session.Abandon()?

Both Session.Clear() and Session.Abandon() get rid of session variables. As I understand it, Abandon() ends the current session, and causes a new session to be created thus causing the End and Start events to fire. It seems preferable to call…
Lance Fisher
  • 25,684
  • 22
  • 96
  • 122
119
votes
6 answers

What is the difference between SessionState and ViewState?

What is the difference between SessionState and ViewState in ASP.NET?
Natrium
  • 30,772
  • 17
  • 59
  • 73
88
votes
6 answers

Can I access session state from an HTTPModule?

I could really do with updating a user's session variables from within my HTTPModule, but from what I can see, it isn't possible. UPDATE: My code is currently running inside the OnBeginRequest () event handler. UPDATE: Following advice received so…
Chris Roberts
  • 18,622
  • 12
  • 60
  • 67
81
votes
5 answers

What's causing “Session state has created a session id, but cannot save it because the response was already flushed by the application.”

I'm getting this fault intermittently. I found this link which summarises fairly well what I was able to find on the…
mike nelson
  • 21,218
  • 14
  • 66
  • 75
81
votes
8 answers

What is the difference between Sessions and Cookies in PHP?

What is the distinction between Sessions and Cookies in PHP?
Harsh
  • 2,078
  • 6
  • 22
  • 37
77
votes
5 answers

How can I disable session state in ASP.NET MVC?

I would like to have a very lightweight ASP.NET MVC site which includes removing as many of the usual HttpModules as possible and disabling session state. However when I try to do this, I get the following error: The SessionStateTempDataProvider…
Daniel Schaffer
  • 56,753
  • 31
  • 116
  • 165
65
votes
4 answers

How to use ASP.NET Session State in an HttpHandler?

I have an HttpHandler that is run on a client page (cross domain, not on our IIS server, etc) and when they click on our embedded link it fires off the Handler on our server. So far everything is working normally. I am now trying to use the…
Keith Barrows
  • 24,802
  • 26
  • 88
  • 134
61
votes
1 answer

Why are there two incompatible session state types in ASP.NET?

I see two means of working with session data in ASP.NET MVC: System.Web.SessionState.HttpSessionState, available on HttpApplication System.Web.HttpSessionStateBase, available on Controller Data stored in one seems to be available in the…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
60
votes
8 answers

How can I check if a user is logged-in in php?

I'm pretty new to PHP and I am trying to figure out how to use sessions to check and see if a user is logged into a website so that they would have authorization to access specific pages. Is this something that is complicated or is it because I am a…
Andrew
  • 629
  • 1
  • 7
  • 6
56
votes
3 answers

Sharing sessions across applications using the ASP.NET Session State Service

I am trying to share sessions between two web applications, both hosted on the same server. One is a .net 2.0 web forms application the other is as .net 3.5 MVC2 application. Both apps have their session set up like this:
Dan
  • 29,100
  • 43
  • 148
  • 207
51
votes
9 answers

Disable Session state per-request in ASP.Net MVC

I am creating an ActionResult in ASP.Net MVC to serve images. With Session state enabled, IIS will only handle one request at a time from the same user. (This is true not just in MVC.) Therefore, on a page with multiple images calling back to this…
Matt Sherman
  • 8,298
  • 4
  • 37
  • 57
50
votes
9 answers

List all active ASP.NET Sessions

How can I list (and iterate through) all current ASP.NET sessions?
Alex
  • 75,813
  • 86
  • 255
  • 348
50
votes
3 answers

How to save and retrieve session from Redis

I am trying to integrate Redis sessions into my authentication system written in Node.js. I have been able to successfully set up Redis server, connect-redis and Express server. Here is my setup (just the important bit): var express =…
Eleeist
  • 6,891
  • 10
  • 50
  • 77
1
2 3
99 100