Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session Management in ASP .NET

Just had a question about session management within ASP .NET. I have looked at the 3 options within IIS (InProc, StateServer and SQL Server) and am having issues deploying session persistence across multiple servers and across multiple web applications. Is there any other options that are available to manage sessions cross sub-domains (from the same parent) as well as over multiple web applications under each domain?

I'll give you an example: Imagine a site www.thisismysite.com.au. When I log in, I go to login.thisismysite.com.au. though browsing the site, I go to www.thisismysite.com.au/MyWebApp/. What I am trying to achieve is for the session to persist across all three links. I am aware of one third party tool that can do this, Groat SessionFarm, but am wondering if there are any others out there? Also, there is a mix of SSL / non SSL if that makes any difference.

Note: I am not worried about identity, I could implement Windows Identity Foundation (or the like) and send claims round all three places. I am after session persistence.

Thanks heaps, Lee

EDIT: I ended up going with a third party piece of code that we could customize for our purposes. Works perfectly, and in buying the source code we can update it as we need to.

like image 816
lkoutzas Avatar asked Aug 08 '11 01:08

lkoutzas


People also ask

What is session in ASP.NET c#?

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.

What is session management in ASP NET MVC?

By default, Asp.Net MVC support session state. Session is used to store data values across requests. Whether you store some data values with in the session or not Asp.Net MVC must manage the session state for all the controllers in your application that is time consuming.


1 Answers

State Server or storage in SQL Server should work fine for what you are trying to do -- even across multiple apps, but you must remember that all applications must have the same MachineKey.

ASPNET-load-balancing-and-ASPNET-state-server

HTH

like image 135
A Rogers Avatar answered Oct 06 '22 18:10

A Rogers