473,721 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using StateServer to share Session across two Web Applications

2 New Member
I am trying to use Session and StateServer to store values to be used by two different Web Applications, which run on the same IIS, in different Virtual Directories.

I have StateServer running on another machine ( I have set the registry key HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\S ervices\aspnet_ state\Parameter s\AllowRemoteCo nnection to 1.

I create two Web Projects in Visual Studio: Redirect and Receive.
Redirect has a Default.aspx which contains a button, and here is the click handler:

protected void Button1_Click(o bject sender, EventArgs e)
Session["Test"] = "Test";
Response.Redire ct("http://localhost/Receive");

Receive has a Default.aspx which contains a label. Here is its Load event handler:

protected void Page_Load(objec t sender, EventArgs e)
this.LabelTest. Text = Session["Test"] as string;

Both Web Application have the same Web.config:

<?xml version="1.0"?>
<configuratio n>
<connectionStri ngs/>
<sessionState mode="StateServ er" cookieless="tru e" timeout="20" stateConnection String="tcpip=1 4"/>
<compilation debug="true" />
<authenticati on mode="Windows" />

As I mentioned, there are two virtual directories off of the Default Web Site in IIS: they map to http://localhost/Redirect and http://localhost/Receive. When i browse to http://localhost/Redirect and click the button, it goes to http://localhost/Receive but the lable text is empty.

Any idea on what I'm doing wrong here?
Sep 6 '07 #1
2 3386
7,872 Recognized Expert Expert
You have to do something fancy with the web.config files I think.
Something about registering a globalID so that the Session can be shared.
I've never done it, only remember reading about it in here somewhere.

I think Friny knows more about this but she has been absent as of late I think.
Sep 6 '07 #2
2 New Member
After searching for a solution, I've starting to see an indication that this may in fact not be possible, since Virtual Directories result in separate App Domains, and these are used to generate unique ApplicationID's . There is a way around this, and my colleague has blogged about it. So I am going to abandon StateServer and go with a SQLServer-based Session persistance.
Sep 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: George Hester | last post by:
In one Application (2) the client is redirected to a Logon ASP in a different Application (1). A Session Variable is made in Application 2 which needs to be recognized in Application 1. Can I do that in Windows 2000 SP3 IIS5 no .NET Framework? Thanks. -- George Hester __________________________________
by: TaeHo Yoo | last post by:
Hi all, I have a solution which contains multiple projects. Those multiple projects should share the same session. For example, users login, create the session for users then these session information should be accessed by multiple projects. How do I archieve this? Any tutorial out there? Thanks
by: Lerp | last post by:
Hi all, I have been asked to build a common login for a cluster of web apps, is it possible to use stateserver to handle/manage session state across more than one web application? Cheers, Lerp
by: GeekBoy | last post by:
I understand the benefit of pushing the StateServer process onto another computer to "balance" the load and take some cpu and memory usage off the web server, but how much could it possibly help? Especially when you're talking about marshalling the data back and forth across your network (although on the same segment)? Here's my scenario: Each login stores exactly 3 session variables; one integer and two strings. That's it. Never, ever,...
by: Justin | last post by:
I am using a 3rd party ecommerce application writen in VB.NET. I have developed a couple c# addons that I would like to integrate into the ecommerce site, more specifically I need to share session information across the pages. Can it be done? Thanks, Justin.
by: masoud bayan | last post by:
Hi, We have 3 different web applications on three different websites (and domains). Now we want to make it possible for users to login in each of these applications and can navigate to other applications without authenticating. So generally we need to have a shared session across applications (a single sign-on).
by: guoqi zheng | last post by:
I have an application in IIS with a few sub domains assign to it. Is there a way for me to share session data across those subdomains? regards, Guoqi Zheng http://www.ureader.com
by: tshad | last post by:
I switched my site from InProc to StateServer a while ago which solve a problem I was having dropping my session cookies when the worker process recycles. This has been working well until today. I was looking at some sample code and found that it won't work under StateServer, but will under InProc. The message I get is:
by: Goofy | last post by:
Does anyone know how I can kill a session by session ID ? -- Goofy
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.