G
Guest
Our website contains session variables that are used to validate if a user is
logged in etc. We have found that these variables are randomly lost while
navigating the website.
We set up some basic code (as shown below) which used a meta tag to refresh
an aspx page every second. It tests whether there is any content in a
session variable, if not then it writes a timestamp to a text file, recreates
the data in the variable and continues. As you can see this script contains
no databases calls etc.
<%response.write(session("Username") & "<br>" & Session.SessionID)
if len(session("Username"))=0 then
Dim FILENAME as String = Server.MapPath("Output.txt")
Dim objStreamWriter as StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine(DateTime.Now.ToString())
objStreamWriter.Close()
session("Username") = "HelloWorld"
end if %>
The output looks like this:
18/04/2006 15:08:18
18/04/2006 15:11:37
18/04/2006 15:18:39
18/04/2006 15:21:40
18/04/2006 15:31:41
18/04/2006 15:34:43
18/04/2006 15:41:44
18/04/2006 15:50:46
18/04/2006 15:56:49
18/04/2006 15:58:47
18/04/2006 16:03:50
18/04/2006 16:06:49
18/04/2006 16:08:49
18/04/2006 16:11:50
18/04/2006 16:14:55
18/04/2006 16:16:55
18/04/2006 16:18:54
18/04/2006 16:23:00
18/04/2006 16:26:00
18/04/2006 16:31:01
18/04/2006 16:35:03
18/04/2006 16:37:05
18/04/2006 16:39:04
18/04/2006 16:41:06
18/04/2006 16:43:12
18/04/2006 16:45:10
18/04/2006 16:50:09
As you can see the session data is dropped usually under 10 minutes but
completely randomly. We have also found that the session id stays the same. I
assume the reason it does stay the same is because that specific data is held
on the client and passed to the server on every communication to the server.
Our webhosting does not support Stateserver or SQLServer state management,
so the only option is InProc. From searching several articles we have found
there are many reasons why this data can be lost. For example if any .config
files or bin files are changed or touched (eg by AV software) then the
application resets and therefore loses the session data. This has also been
tested by us and can confirm this happens.
As our website is hosted on a shared server, we assume that other sites are
or could be having similar issues as us.
Has anyone experienced this particular issue before?
Thanks in advance.
Regards
Sarah Marriott.
logged in etc. We have found that these variables are randomly lost while
navigating the website.
We set up some basic code (as shown below) which used a meta tag to refresh
an aspx page every second. It tests whether there is any content in a
session variable, if not then it writes a timestamp to a text file, recreates
the data in the variable and continues. As you can see this script contains
no databases calls etc.
<%response.write(session("Username") & "<br>" & Session.SessionID)
if len(session("Username"))=0 then
Dim FILENAME as String = Server.MapPath("Output.txt")
Dim objStreamWriter as StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine(DateTime.Now.ToString())
objStreamWriter.Close()
session("Username") = "HelloWorld"
end if %>
The output looks like this:
18/04/2006 15:08:18
18/04/2006 15:11:37
18/04/2006 15:18:39
18/04/2006 15:21:40
18/04/2006 15:31:41
18/04/2006 15:34:43
18/04/2006 15:41:44
18/04/2006 15:50:46
18/04/2006 15:56:49
18/04/2006 15:58:47
18/04/2006 16:03:50
18/04/2006 16:06:49
18/04/2006 16:08:49
18/04/2006 16:11:50
18/04/2006 16:14:55
18/04/2006 16:16:55
18/04/2006 16:18:54
18/04/2006 16:23:00
18/04/2006 16:26:00
18/04/2006 16:31:01
18/04/2006 16:35:03
18/04/2006 16:37:05
18/04/2006 16:39:04
18/04/2006 16:41:06
18/04/2006 16:43:12
18/04/2006 16:45:10
18/04/2006 16:50:09
As you can see the session data is dropped usually under 10 minutes but
completely randomly. We have also found that the session id stays the same. I
assume the reason it does stay the same is because that specific data is held
on the client and passed to the server on every communication to the server.
Our webhosting does not support Stateserver or SQLServer state management,
so the only option is InProc. From searching several articles we have found
there are many reasons why this data can be lost. For example if any .config
files or bin files are changed or touched (eg by AV software) then the
application resets and therefore loses the session data. This has also been
tested by us and can confirm this happens.
As our website is hosted on a shared server, we assume that other sites are
or could be having similar issues as us.
Has anyone experienced this particular issue before?
Thanks in advance.
Regards
Sarah Marriott.