Click here to Skip to main content
Click here to Skip to main content

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

Comments and Discussions

 
QuestionSession does not work among two application sharing two diffrent IPs and Header value. any solutuion ? PinmemberMyRitu13-Apr-09 21:35 
GeneralDetail Pinmemberaqua19822-Jun-08 1:44 
GeneralExtra Information need on this PinmemberSachin Pisal16-Aug-05 19:34 
GeneralThanks! Pinsussshroomy11-Jun-04 7:35 
QuestionHow can I to know my Web Application's AppName PinmemberCesar Briano1-Nov-03 9:09 
AnswerRe: How can I to know my Web Application's AppName Pinmember.NET Follower21-Jan-04 0:11 
GeneralNot exactly safe and reliable PinsussAnonymously12-Sep-03 16:15 
GeneralDoesn't explain Pinmemberdog_spawn12-Sep-03 14:11 

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

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

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