and another discovery:
if the session is null, Session.IsNewSession is true .... with the same
SessionID like before...
Newsbeitrag i'm not using frames in my test-environment ...
How du I use System.Web.ProcessModelInfo.GetHistory ?
BTW the applicationstate and the sessionstate variables are disappearing
independet of each other.
Output also the current date and time as well as the session id (to make
sure there is no cache issue and to see if the session is the same or
not).
You could as well try Session.IsNew (if I remember) to see if it's
considered as a new session (despite perhaps using the same id as you
mentionned)..
Though you mentionned that the aplication doesn't restart could you
double
check this (for example using the performance counter or by using
programmatically System.Web.ProcessModelInfo.GetHistory)... If the
application restarts it could perhaps loose the session variable
while
keeping the same session id...
BTW do you still use frames ? Does it happens without frames ?
Good luck.
Patrice
--
"Alexander Widera" <
[email protected]> a écrit dans le
message de it has all its order... in my "test-environment" i call the pages
sepereately. at first the sessiontest1.aspx and after it the
sessiontest2.aspx
And how are these pages related ? Are they both used in the frameset
?
In particular if they are both used in the same frameset I'm not sure
the
order in which they are called is predictable.
I would do something like :
- in both pages add something to the current value of the testvar
variable
(such as a datetime and the name of the page) and display the
value
- this way when printed you'll see in whic order it was loaded
You could also simply try to see in the IIS log if one is always
called
before the other or if it's sometimes the other way round...
--
"Alexander Widera" <
[email protected]> a écrit dans
le
message de ok... all details.... i tried some other simple code .. and the same
problem
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", "123");
if (Application["timestamp"]==null) Application.Add("timestamp",
DateTime.Now);
}
</script>
No error on call.... .... it creates a sessionvar named "testvar"
and
sets
the value to "123" ... the script also sets an applicationvar
"timestamp"
to
the current time.
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("tv: " + Session["testvar"] + " and TS:
"+Application["timestamp"]);
}
</script>
A simple output .... but sometimes the sessionvar is null.. .and
sometimes
it is "123"...
After many tries I also found out, that it's the same with the
applicationvar .... both "disappear" at the same time ....
I have a trace for you....
at first the trace with both vars working:
Request Details
Session Id: yiiqjj3qiqsguu55g4b1f4bk Request Type: GET
Time of Request: 18.05.2005 12:53:06 Status Code: 200
Request Encoding: Western European (ISO) Response Encoding:
Western
European (ISO)
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin Init
aspx.page End Init 0,000018 0,000018
aspx.page Begin PreRender 0,000084 0,000066
aspx.page End PreRender 0,000104 0,000020
aspx.page Begin SaveViewState 0,000149 0,000045
aspx.page End SaveViewState 0,000165 0,000016
aspx.page Begin Render 0,000180 0,000015
aspx.page End Render 0,000468 0,000288
Control Tree
Control Id Type Render Size Bytes (including children)
Viewstate
Size
Bytes (excluding children)
__PAGE ASP.sessiontest2_aspx 0 0
Session state
Session Key Type Value
testvar System.String 123
Application State
Application Key Type Value
Uhrzeit System.DateTime 18.05.2005 12:45:58
Cookies Collection
Name Value Size
ASP.NET_SessionId yiiqjj3qiqsguu55g4b1f4bk 42
Headers Collection
Name Value
Cache-Control max-age=0
Connection keep-alive
Keep-Alive 300
Accept
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip,deflate
Accept-Language de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Cookie ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
Host
www.xxxxxxxxxxxxxxxxxx.com
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE;
rv:1.7.8)
Gecko/20050511 Firefox/1.0.4
Server Variables
Name Value
ALL_HTTP HTTP_CACHE_CONTROL:max-age=0
HTTP_CONNECTION:keep-alive
HTTP_KEEP_ALIVE:300
HTTP_ACCEPT:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,t
ext/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING:gzip,deflate
HTTP_ACCEPT_LANGUAGE:de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
HTTP_COOKIE:ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
HTTP_HOST:
www.xxxxxxxxxxxxxxxxxx.comHTTP_USER_AGENT:Mozilla/5.0
(Windows;
U;
Windows NT 5.1; de-DE; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
ALL_RAW Cache-Control: max-age=0 Connection: keep-alive
Keep-Alive:
300 Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Encoding:
gzip,deflate
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Cookie:
ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk Host:
www.xxxxxxxxxxxxxxxxxx.comUser-Agent : Mozilla/5.0 (Windows; U;
Windows
NT
5.1; de-DE; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
APPL_MD_PATH /LM/W3SVC/1072123260/Root
APPL_PHYSICAL_PATH E:\Webpub\page123\
AUTH_TYPE
AUTH_USER
AUTH_PASSWORD
LOGON_USER
REMOTE_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH 0
CONTENT_TYPE
GATEWAY_INTERFACE CGI/1.1
HTTPS off
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID 1072123260
INSTANCE_META_PATH /LM/W3SVC/1072123260
LOCAL_ADDR XXXXXXXXX
PATH_INFO /intern/sessiontest2.aspx
PATH_TRANSLATED E:\Webpub\page123\intern\sessiontest2.aspx
QUERY_STRING
REMOTE_ADDR XXXXXXXXX
REMOTE_HOST XXXXXXXXX
REMOTE_PORT 60224
REQUEST_METHOD GET
SCRIPT_NAME /intern/sessiontest2.aspx
SERVER_NAME XXXXXXXXX
SERVER_PORT 80
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/6.0
URL /intern/sessiontest2.aspx
HTTP_CACHE_CONTROL max-age=0
HTTP_CONNECTION keep-alive
HTTP_KEEP_ALIVE 300
HTTP_ACCEPT
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT_LANGUAGE de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
HTTP_COOKIE ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
HTTP_HOST XXXXXXXXX
HTTP_USER_AGENT Mozilla/5.0 (Windows; U; Windows NT 5.1;
de-DE;
rv:1.7.8) Gecko/20050511 Firefox/1.0.4
And now the trace when the vars are null or doesn't exist:
Request Details
Session Id: yiiqjj3qiqsguu55g4b1f4bk Request Type: GET
Time of Request: 18.05.2005 12:56:28 Status Code: 200
Request Encoding: Western European (ISO) Response Encoding:
Western
European (ISO)
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin Init
aspx.page End Init 0,000019 0,000019
aspx.page Begin PreRender 0,000058 0,000039
aspx.page End PreRender 0,000074 0,000016
aspx.page Begin SaveViewState 0,000133 0,000058
aspx.page End SaveViewState 0,000149 0,000017
aspx.page Begin Render 0,000164 0,000015
aspx.page End Render 0,000446 0,000282
Control Tree
Control Id Type Render Size Bytes (including children)
Viewstate
Size
Bytes (excluding children)
__PAGE ASP.sessiontest2_aspx 0 0
Cookies Collection
Name Value Size
ASP.NET_SessionId yiiqjj3qiqsguu55g4b1f4bk 42
Headers Collection
Name Value
Cache-Control max-age=0
Connection keep-alive
Keep-Alive 300
Accept
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip,deflate
Accept-Language de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Cookie ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
Host XXXXXXXX
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE;
rv:1.7.8)
Gecko/20050511 Firefox/1.0.4
Server Variables
Name Value
ALL_HTTP HTTP_CACHE_CONTROL:max-age=0
HTTP_CONNECTION:keep-alive
HTTP_KEEP_ALIVE:300
HTTP_ACCEPT:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,t
ext/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING:gzip,deflate
HTTP_ACCEPT_LANGUAGE:de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
HTTP_COOKIE:ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
HTTP_HOST:XXXXXXXX
HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE;
rv:1.7.8)
Gecko/20050511 Firefox/1.0.4
ALL_RAW Cache-Control: max-age=0 Connection: keep-alive
Keep-Alive:
300 Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Encoding:
gzip,deflate
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Cookie:
ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk Host: XXXXXXXX
User-Agent:
Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.7.8)
Gecko/20050511
Firefox/1.0.4
APPL_MD_PATH /LM/W3SVC/1072123260/Root
APPL_PHYSICAL_PATH E:\Webpub\page123\
AUTH_TYPE
AUTH_USER
AUTH_PASSWORD
LOGON_USER
REMOTE_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH 0
CONTENT_TYPE
GATEWAY_INTERFACE CGI/1.1
HTTPS off
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID 1072123260
INSTANCE_META_PATH /LM/W3SVC/1072123260
LOCAL_ADDR XXXXXXXX
PATH_INFO /intern/sessiontest2.aspx
PATH_TRANSLATED E:\Webpub\page123\intern\sessiontest2.aspx
QUERY_STRING
REMOTE_ADDR XXXXXXXX
REMOTE_HOST XXXXXXXX
REMOTE_PORT 60341
REQUEST_METHOD GET
SCRIPT_NAME /intern/sessiontest2.aspx
SERVER_NAME XXXXXXXX
SERVER_PORT 80
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/6.0
URL /intern/sessiontest2.aspx
HTTP_CACHE_CONTROL max-age=0
HTTP_CONNECTION keep-alive
HTTP_KEEP_ALIVE 300
HTTP_ACCEPT
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT_LANGUAGE de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
HTTP_COOKIE ASP.NET_SessionId=yiiqjj3qiqsguu55g4b1f4bk
HTTP_HOST XXXXXXXX
HTTP_USER_AGENT Mozilla/5.0 (Windows; U; Windows NT 5.1;
de-DE;
rv:1.7.8) Gecko/20050511 Firefox/1.0.4
and that's it .. .i don't know more .... there must be something
wrong
in
the prefences of the server ... but what? and where?
no Application_Start() event is called meanwhile .... if it would be
so...
i
would get an email...
please help me