Click here to Skip to main content
6,634,665 members and growing! (15,733 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate

Sharing session state over multiple ASP.NET applications

By SampoSoft

This is an article that explains how to share session variables over multiple applications.
.NET 1.0, .NET 1.1, Win2K, WinXP, Win2003, ASP.NET, Visual Studio, Dev
Posted:11 Sep 2003
Views:55,507
Bookmarked:21 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
24 votes for this article.
Popularity: 1.72 Rating: 1.24 out of 5
20 votes, 83.3%
1
1 vote, 4.2%
2
1 vote, 4.2%
3

4
2 votes, 8.3%
5

Introduction

I have modified the SQL script that create the SQL Server Database for storing the ASP.NET session state.

Using the code

In web.config you must change the sessionState from "InProc" to "SQLServer" and specify the correct SQL connection string.

<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests 
belong to a particular session. 
If cookies are not available, a session can be tracked 
by adding a session identifier to the URL. 
To disable cookies, set sessionState cookieless="true".
-->
<sessionState 
mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" 
timeout="20" 
/>

I have added a table named ASPStateApplications that can be used to set the applications that share the session state.

Sample Image - Sharing_session_state.jpg

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

SampoSoft


Member

Occupation: Web Developer
Location: Italy Italy

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 8 of 8 (Total in Forum: 8) (Refresh)FirstPrevNext
GeneralSession does not work among two application sharing two diffrent IPs and Header value. any solutuion ? PinmemberMyRitu21:35 13 Apr '09  
GeneralDetail Pinmemberaqua19821:44 2 Jun '08  
GeneralExtra Information need on this PinmemberSachin Pisal19:34 16 Aug '05  
GeneralThanks! Pinsussshroomy7:35 11 Jun '04  
GeneralHow can I to know my Web Application's AppName PinmemberCesar Briano9:09 1 Nov '03  
GeneralRe: How can I to know my Web Application's AppName Pinmember.NET Follower0:11 21 Jan '04  
GeneralNot exactly safe and reliable PinsussAnonymously16:15 12 Sep '03  
GeneralDoesn't explain Pinmemberdog_spawn14:11 12 Sep '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 11 Sep 2003
Editor:
Copyright 2003 by SampoSoft
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project