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 (192.168.0.1). I have set the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\aspnet_state\Parameters\AllowRemoteConnection 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(object sender, EventArgs e)
{
Session["Test"] = "Test";
Response.Redirect("http://localhost/Receive");
}
Receive has a Default.aspx which contains a label. Here is its Load event handler:
protected void Page_Load(object sender, EventArgs e)
{
this.LabelTest.Text = Session["Test"] as string;
}
Both Web Application have the same Web.config:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<sessionState mode="StateServer" cookieless="true" timeout="20" stateConnectionString="tcpip=192.168.0.1:42424"/>
<compilation debug="true" />
<authentication mode="Windows" />
</system.web>
</configuration>
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?