hello all,
i have a problem ...
like I already discussed in the thread "session empty" I have the following
problem:
I created a completely new web...
i added 2 files:
sessiontest1.aspx:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1"
Trace="true" %>
<script runat="server">
public void Page_Load(Object sender, EventArgs e)
{
Session.Add("testvar", DateTime.Now);
if (Application["timestamp"]==null) Application.Add("timestamp",
DateTime.Now);
}
</script>
sessiontest2.aspx:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1"
Trace="true" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
Response.Write("testvar(session): " + Session["testvar"] + " and
timestamp(appl): "+Application["timestamp"]);
if (Session.IsNewSession) Response.Write("new SESSION");
Response.Write("<br>Session is running out in: " + Session.Timeout);
}
</script>
If I run sessiontest1.aspx there should be placed an applicationvar and an
sessionvar ... both with the current time.
After that I call the sessiontest2.aspx.
You can see that it does nothing else than sending these two variables to
the browseroutput. It simple. ..
but now the problem ...
sometimes all works... i get the output for example:
"testvar(session): 19.05.2005 19:17:52 and timestamp(appl): 19.05.2005
19:17:52
Session is running out in: 20"
but sometimes i get the output:
" testvar(session): and timestamp(appl): new SESSION
Session is running out in: 20 "
only if i reload the page... and then after another reload of the page
(sessiontest2.aspx) i get the first output (the correct one).
it is random what is showed after a new reload ... either the correct
version with the variables available or the versions where the variables are
not available.
If it is the problematic case it is also IsNewSession == true.... but why?
The trace of the page sais me, that both variables are not registered (im
speaking of the problematic-case).
And it's getting even better:
If I call again "sessiontest1.aspx" and i have luck ... and I call again the
sessiontest2.aspx a few times .... I can see that there are now 2 versions
of both variables are existing ...
one time i get:
" testvar(session): 19.05.2005 19:17:52 and timestamp(appl): 19.05.2005
19:17:52
Session is running out in: 20 "
and one time i get:
" testvar(session): 19.05.2005 19:28:31 and timestamp(appl): 19.05.2005
19:28:31
Session is running out in: 20 "
both versions are alternating randomly...
what is this?
why is this?
please help me!!!
thank you
Alex