By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,012 Members | 1,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,012 IT Pros & Developers. It's quick & easy.

Session variable data being lost

P: n/a
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.
Apr 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Tell your ISP to turn off the AV check.

"Sarah Marriott" <Sarah Ma******@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
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.

Apr 18 '06 #2

P: n/a
Hi Jeff,

Sorry for the late reply - you know how ISPs are at getting back to you :)

We asked the questions, and they stated that AV doesn't actually run on
their webservers.

Any other ideas?

Regards

Sarah

"Jeff Dillon" wrote:
Tell your ISP to turn off the AV check.

"Sarah Marriott" <Sarah Ma******@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
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.


Apr 21 '06 #3

P: n/a
I've been having strange problems for the past month, since going live
with a new site. (http://www.paintworldinc.com) At first I thought
these were user errors. As traffic has been steadily increasing, so
have these errors. They are EXACTLY as you describe. Sometimes, a user
will get as far as the checkout page, populate the form, then hit the
submit - that's when the system will throw an exception. I have code in
place to catch these errors, and write the exception.message text to
the database. They have been due to trying to insert a null into a
required database field - this is data that was held in a session
variable.

I was going to use persistent state - but my host provider does not yet
support it, although they might be turning this on as I write.

Aside from that, I may just implement my own custom session variable
store - using SQL Server as my storage.

If you solve this, please post back as to your own solution.

Regards,

-DG

Sarah Marriott wrote:
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.


May 14 '06 #4

P: n/a
Hi,

Our ISP finally got back to us saying that this problem is due to our site
being held on a Server Farm. There is nothing they will do to resolve this
issue. So we have had to handle it by storing a flag in the db which the code
checks if there is no session data available. If the flag has been set then
it re-establishes the session data. This is tedious and does result in more
calls to the db, but the site is more stable.

I'm guessing that you'll have to implement something similar or use the db
like you say.

This is rather annoying and I'm surprised more people are not complaining
about it. Maybe many people do not realise this is happening - scary!

Hope this helps.

Best regards,

Sarah

"df********@gmail.com" wrote:
I've been having strange problems for the past month, since going live
with a new site. (http://www.paintworldinc.com) At first I thought
these were user errors. As traffic has been steadily increasing, so
have these errors. They are EXACTLY as you describe. Sometimes, a user
will get as far as the checkout page, populate the form, then hit the
submit - that's when the system will throw an exception. I have code in
place to catch these errors, and write the exception.message text to
the database. They have been due to trying to insert a null into a
required database field - this is data that was held in a session
variable.

I was going to use persistent state - but my host provider does not yet
support it, although they might be turning this on as I write.

Aside from that, I may just implement my own custom session variable
store - using SQL Server as my storage.

If you solve this, please post back as to your own solution.

Regards,

-DG

Sarah Marriott wrote:
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.


May 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.