Click here to Skip to main content
13,087,566 members (95,222 online)
Click here to Skip to main content
Add your own
alternative version

Stats

85.9K views
1.3K downloads
25 bookmarked
Posted 11 Sep 2003

Sharing session state over multiple ASP.NET applications

, 11 Sep 2003
Rate this:
Please Sign up or sign in to vote.
This is an article that explains how to share session variables over multiple applications.
<!-- Add the rest of your HTML here -->

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.

<!--<span class="code-comment"> 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".
--></span>
<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

Share

About the Author

SampoSoft
Web Developer
Italy Italy
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionSession does not work among two application sharing two diffrent IPs and Header value. any solutuion ? Pin
MyRitu13-Apr-09 20:35
memberMyRitu13-Apr-09 20:35 
GeneralDetail Pin
aqua19822-Jun-08 0:44
memberaqua19822-Jun-08 0:44 
GeneralExtra Information need on this Pin
Sachin Pisal16-Aug-05 18:34
memberSachin Pisal16-Aug-05 18:34 
GeneralThanks! Pin
shroomy11-Jun-04 6:35
sussshroomy11-Jun-04 6:35 
QuestionHow can I to know my Web Application's AppName Pin
Cesar Briano1-Nov-03 8:09
memberCesar Briano1-Nov-03 8:09 
AnswerRe: How can I to know my Web Application's AppName Pin
.NET Follower20-Jan-04 23:11
member.NET Follower20-Jan-04 23:11 
GeneralNot exactly safe and reliable Pin
Anonymously12-Sep-03 15:15
sussAnonymously12-Sep-03 15:15 
GeneralDoesn't explain Pin
dog_spawn12-Sep-03 13:11
memberdog_spawn12-Sep-03 13:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 12 Sep 2003
Article Copyright 2003 by SampoSoft
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid