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
26
votes
3 answers

IRequiresSessionState vs IReadOnlySessionState

What is the difference between IRequiresSessionState and IReadOnlySessionState beside the inability of the second to save changes to the session variables? Both provide me the ability to access session variables in my HttpHandler. But why would I…
Oleg Grishko
  • 4,132
  • 2
  • 38
  • 52
26
votes
6 answers

Pros and Cons of using ASP.NET Session State Server (instead of InProc)?

Before I start using Session State server for the benefit of making session state more robust in my apps compared to InProc state, I'd like to find a list of Pros and Cons for evaluation. Update 1: Also about surviving application pool…
John K
  • 28,441
  • 31
  • 139
  • 229
26
votes
3 answers

Detecting Session expiry on ASP.NET MVC

I have built a shopping cart that uses Session State to keep the shopping cart data while the user is browsing the store. I have an issue where if I leave the browser window open for a long time on step1 of the shopping cart, then press "go to step…
CVertex
  • 17,997
  • 28
  • 94
  • 124
25
votes
3 answers

Which one is better, InProc or SQL Server, for Session State mode in asp.net?

I am developing an ASP.NET website. I want to know which one is better in session state mode: InProc or SQL Server? I need to hear about your experiences on this issue. Another question is about cookieless attribute. Is there any security hole in my…
Ali Foroughi
  • 4,540
  • 7
  • 42
  • 66
25
votes
2 answers

ASP.NET 5 (Core): How to store objects in session-cache (ISession)?

I am writing an ASP.NET 5 MVC 6 (Core) application. Now I came to a point where I need to store (set and get) an object in the session-cache (ISession). As you may know, the Set-method of ISession takes a byte-array and the Get-method returns…
evaenrique
  • 981
  • 2
  • 8
  • 17
24
votes
1 answer

Rails 3 additional session configuration options (key, expires_after, secure)

Can someone point out what the new Rails 3.x session configuration options are? I'm trying to duplicate the same configuration that I have in my Rails 2.3.x application. This is the configuration that I used in the…
shedd
  • 4,198
  • 4
  • 33
  • 42
24
votes
13 answers

ASP.Net Session

I am wanting to store the "state" of some actions the user is performing in a series of different ASP.Net webforms. What are my choices for persisting state, and what are the pros/cons of each solution? I have been using Session objects, and using…
Steve Horn
  • 8,818
  • 11
  • 45
  • 60
23
votes
3 answers

Invalidating client side JWT session

I've read a lot about JWT and how to create "stateless" sessions through JWT. The gist of what I understand is that because of the signature & expiration, you can essentially send the entire session to be saved by the client and the server does not…
wlingke
  • 4,699
  • 4
  • 36
  • 52
23
votes
8 answers

Getting session in .NET ASMX web-service

I have an ASMX webservice hosted alongside my ASP.NET web app. Now, I need to get the users session into the Webservice. To test this I made this simple method: [WebMethod(EnableSession = true)] public string checkSession() { …
Matt
  • 1,562
  • 2
  • 17
  • 27
23
votes
3 answers

Saving data to session in JSF

I am new to the world of J(2)EE and web app development but am quickly navigating my way around it and learning a lot. Every day is a fantastic voyage of new discovery for me. I am currently working on a project in which I am using Visual JSF…
SibzTer
  • 1,737
  • 4
  • 14
  • 18
22
votes
6 answers

Allowing Session in a Web Farm? Is StateServer Good Enough?

First of all to give you a bit of background on the current environment. We have a number of ASP.NET applications, all of which use session for certain aspects. We are "Load Balanced" over multiple servers due to traffic levels, however, our load…
Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
22
votes
3 answers

Configure ASP.NET Session State at runtime

We have an ASP.NET web site that uses SQL Server session state. The state is configured in Web.config like:
Andomar
  • 232,371
  • 49
  • 380
  • 404
22
votes
3 answers

How to view Session Variables in Visual Studio 2008 Debugger?

Usually using Visual Studio's debugger is a breeze. Scanning through Locals quickly shows the values of variables, etc. However, I'm at a loss how to find out the values contained in session state variables? Can anyone give me a hand? Let's say I…
Dave Mackey
  • 4,306
  • 21
  • 78
  • 136
22
votes
4 answers

Requests hanging on Session module on IIS 7.5

From time to time, some requests on my website starts to hang on the RequestAcquireState state of the Session module. When that spiral begins all requests timeout and we need to restart the IIS on the affected server. I investigated it a lot and the…
tucaz
  • 6,524
  • 6
  • 37
  • 60
22
votes
4 answers

How does Microsoft Azure handle Session State?

Does anyone have any information on how state is managed in Azure when you choose to have multiple instances? It seems like InProc would be worthless and you would have to have another state server instance, or use the datastore to store the…
Arron S
  • 5,511
  • 7
  • 50
  • 57