G
Guest
I'm saving some values to the Session state and get some strange results.
To be short I'll write example code and standart behavior:
Code Example:
/////////////////////////////////////////////////////////////////////////////////////////
private void WriteToSessionButton_Click(object sender, , System.EventArgs e)
{
Session["something"] = "My value";
}
private void CheckSessionButton_Click(object sender, , System.EventArgs e)
{
if(Session["something"] != null)
{
SessionVariable_Label.Text = Session["something"].ToString();
}
else
{
SessionVariable_Label.Text = "N/A";
}
SessionId_Label.Text = Session.SessionID;
}
/////////////////////////////////////////////////////////////////////////////////////////
TYPICAL (CORRECT) BEHAVIOUR:
When I run my ASP.NET procejt from localhost
(http://localhost/MySessionProject/Default.aspx) after clreating required
Session variable by clicking the WriteToSessionButton button, I check Session
variables by clicking CheckSessionButton button.
The values are correct and after each Post_Back, no matter how many times I
click the buttons everything works just like it's suppost to be. I get the
Session["something"] value and same SessionId after each Post_Back.
THE PROBLEM:
However, when I open my project substituting "localhost" with My computer
name like this http://MyComputerName/MySessionProject/Default.aspx, after
creating Session variable and clicking CheckSessionButton button I get empty
variable (SessionVariable_Label.Text = "N/A") and the Session.SessionId value
is different after each Post_Back.
This behaviour is not random. It happens every time.
localhost - Session variable and SessionId remains;
MyComputerName - Session variable dissapears, Session.SessionId changes
after each Post_Back.
ABOUT SESSION STATE:
I tried InProc and StateServer configurations.
OTHER INFO:
And it's not page or project specific. It happens with any page or project.
It's also not machine (computer) specific as I tried it other development
computer in our network and got the same results.
I have Intel Pentium 2.8 DualCore CPU on both developement machines.
Network managed by ActiveDirectory.
To be short I'll write example code and standart behavior:
Code Example:
/////////////////////////////////////////////////////////////////////////////////////////
private void WriteToSessionButton_Click(object sender, , System.EventArgs e)
{
Session["something"] = "My value";
}
private void CheckSessionButton_Click(object sender, , System.EventArgs e)
{
if(Session["something"] != null)
{
SessionVariable_Label.Text = Session["something"].ToString();
}
else
{
SessionVariable_Label.Text = "N/A";
}
SessionId_Label.Text = Session.SessionID;
}
/////////////////////////////////////////////////////////////////////////////////////////
TYPICAL (CORRECT) BEHAVIOUR:
When I run my ASP.NET procejt from localhost
(http://localhost/MySessionProject/Default.aspx) after clreating required
Session variable by clicking the WriteToSessionButton button, I check Session
variables by clicking CheckSessionButton button.
The values are correct and after each Post_Back, no matter how many times I
click the buttons everything works just like it's suppost to be. I get the
Session["something"] value and same SessionId after each Post_Back.
THE PROBLEM:
However, when I open my project substituting "localhost" with My computer
name like this http://MyComputerName/MySessionProject/Default.aspx, after
creating Session variable and clicking CheckSessionButton button I get empty
variable (SessionVariable_Label.Text = "N/A") and the Session.SessionId value
is different after each Post_Back.
This behaviour is not random. It happens every time.
localhost - Session variable and SessionId remains;
MyComputerName - Session variable dissapears, Session.SessionId changes
after each Post_Back.
ABOUT SESSION STATE:
I tried InProc and StateServer configurations.
OTHER INFO:
And it's not page or project specific. It happens with any page or project.
It's also not machine (computer) specific as I tried it other development
computer in our network and got the same results.
I have Intel Pentium 2.8 DualCore CPU on both developement machines.
Network managed by ActiveDirectory.