472,973 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 software developers and data experts.

Loss of values in session

Chaps.

We are working with SQL-Server based Sessions in the following environemtn:

Win-Server 2K3 incl. IIS, Dot Net Framework 1.1, SQL2K SP3a, German.

We are defining a Session-Variable named keyword inside asp.net website. At
the end of the Website we are writing this variable again to test if the
value still exists to the output-buffer.

The variable-value is set at the end of the page. When we now press enter in
a input-form-field on the website which results in submitting the page
automatically, Session-variable which is written to output-buffer directly
after variable definition-part, is empty.

Session-Variable is set with the value of a String().

Why is that? Is there any clue on this?

Steve
Nov 19 '05 #1
8 1646
Hi Steve,

Welcome to ASPNET newsgroup.
From your description, you're encountering some probems when using
SqlServer SessionState in asp.net application. You found the data you
stored not exist when try retrieving it later, yes?

As for this problem, I'm still wondering on something you mentioned:

1.Does the "At the end of the Website" you mentioned means the end of each
Page Request? If so , would you provide some more detailed info on the code
logic such as in what event do you do that work and some code snippet will
helps more. If you can provide a complete page and the code snippet, we
can try performing some tests on ourside.

2. As you're using the SQLserver session, have you also test through InProc
session to see whether the problem also occurs. This can help us confirm
whether this is a SqlServer mode related issue.

If there're any other info, please feel free to post here, also. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 19 '05 #2
Hi Steven,

thanks for this fast answer.
From your description, you're encountering some probems when using
SqlServer SessionState in asp.net application. You found the data you
stored not exist when try retrieving it later, yes? Yes, but there are several Session-Variables which persist, so it is
not a general Problem in setting values to Session-Variables.
I thought of perhaps a limit on the count of usable session-variables,
or a memory limit.
As for this problem, I'm still wondering on something you mentioned:

1.Does the "At the end of the Website" you mentioned means the end of
each
Page Request? If so , would you provide some more detailed info on the
code
logic such as in what event do you do that work and some code snippet
will
helps more. If you can provide a complete page and the code snippet, we
can try performing some tests on ourside. I can't provide you with the complete page now, cause it is a webshop of a
customer as for you would need a login which can't be created for the
moment.

here is the relevant code which defines the session-vars and prints 'em
out:

Session.Timeout = 15
Dim post_vars As New Hashtable
for i As Integer = 0 to (Request.Form.Count - 1)
post_vars.Add(Request.Form.GetKey(i), Request.Form(i).ToString)
next

...

Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword") &
"<br>")

...

if IsNothing(Session("keyword")) = false then
if post_vars.Item("keyword") <> Session("keyword") then
Session("keyword") = post_vars.Item("keyword")
end if
else
Session.Add("keyword", post_vars.Item("keyword"))
end if
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword") &
"<br>")

...

</html>
<%
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword")
& "<br>")
%>

2. As you're using the SQLserver session, have you also test through
InProc
session to see whether the problem also occurs. This can help us confirm
whether this is a SqlServer mode related issue.


No, not tested till now. Will test this this afternoon and write another
answert on this post
with the result though.
Perhaps there is already sth in this post that can help you with my
problem.
Thanks for now,

Steve
Nov 19 '05 #3
Hi Steve,

Thanks for your code snippet, now I got that your "end of web app" means
the below code block after </html> tag, yes?

</html>
<%
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword")
& "<br>")
%>
Also, as for the former code period
====================
Session.Timeout = 15
Dim post_vars As New Hashtable
for i As Integer = 0 to (Request.Form.Count - 1)
post_vars.Add(Request.Form.GetKey(i), Request.Form(i).ToString)
next

...

Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword") &
"<br>")

...

if IsNothing(Session("keyword")) = false then
if post_vars.Item("keyword") <> Session("keyword") then
Session("keyword") = post_vars.Item("keyword")
end if
else
Session.Add("keyword", post_vars.Item("keyword"))
end if
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword") &
"<br>")

...
====================

are they also put in the aspx inline directly or in code behind page
events? This is very important since the ASP.NET has different page object
model from classic ASP and all the code in aspx template(inline) will be
compiled into a single method and be called as part of the PAGE's render
progress.

Also, you don't need to provide me the complete code of your page. I'm just
wondering a very simple page with very simple code page which can just
represent the problem you encountered. So Would you try buiding a dummy
page ?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4
Hello Steven,

yes all of the code in this case is inline.
I tried InProc-Session-Handling now. With InProc everything works as
expected.
So with InProc there is no loss of values in Sessions or so.

If you want to have a login to the webshop, please tell me where to send
the
login-data to, so that you can login and see what happens. A description
on how
you can experience the problem will be send with the login-data though.
Thanks for your help in Advance.
Steve

Am Mon, 30 May 2005 10:57:19 +0200 schrieb Steven Cheng[MSFT]
<v-******@online.microsoft.com>:
Hi Steve,

Thanks for your code snippet, now I got that your "end of web app" means
the below code block after </html> tag, yes?

</html>
<%
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword")
& "<br>")
%>
Also, as for the former code period
====================
Session.Timeout = 15
Dim post_vars As New Hashtable
for i As Integer = 0 to (Request.Form.Count - 1)
post_vars.Add(Request.Form.GetKey(i), Request.Form(i).ToString)
next

...

Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword")
&
"<br>")

...

if IsNothing(Session("keyword")) = false then
if post_vars.Item("keyword") <> Session("keyword") then
Session("keyword") = post_vars.Item("keyword")
end if
else
Session.Add("keyword", post_vars.Item("keyword"))
end if
Response.Write(Session("keyword") & " <-> " & post_vars.Item("keyword")
&
"<br>")

...
====================

are they also put in the aspx inline directly or in code behind page
events? This is very important since the ASP.NET has different page
object
model from classic ASP and all the code in aspx template(inline) will be
compiled into a single method and be called as part of the PAGE's render
progress.

Also, you don't need to provide me the complete code of your page. I'm
just
wondering a very simple page with very simple code page which can just
represent the problem you encountered. So Would you try buiding a dummy
page ?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/
Nov 19 '05 #5
Thanks Steve,

Before we looking into depth of your code logic or your web shop, I'd like
to confirm whether this is a environment specific problem. Based on my
local test, I can read and update Sessionstate(sqlserver mode) in the aspx
inline code. Here is my test page:

==================================
<HTML>
<HEAD>
<title>inlineSessionProcess</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<%
Response.Write("<br>FirstLoop:");
foreach(string key in Session.Keys)
{
Response.Write(string.Format("<br/>{0}: {1}", key, Session[key]));
}

%>
<%
if(Request.Form["override"] != null)
{
Session["txt1"] = Request.Form["txt1"];
Session["txt2"] = Request.Form["txt2"];
Session["txt3"] = Request.Form["txt3"];
Session["txt4"] = Request.Form["txt4"];
}

%>
<form id="Form1" method="post" runat="server">
<br/><INPUT name="txt1" type="text">
<br/><INPUT name="txt2" type="text">
<br/><INPUT name="txt3" type="text">
<br/><INPUT name="txt4" type="text">
<br/><input type="checkbox" name="override" />
<br/><INPUT name="btnSubmit" type="submit" value="Submit">
</form>
<%
Response.Write("<br>SecondLoop:");
foreach(string key in Session.Keys)
{
Response.Write(string.Format("<br/>{0}: {1}", key, Session[key]));
}

%>
</body>
</HTML>
================================

Is the above code able to repro the problem on your side? Or shall I miss
anything else so as to repro the problem?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6
Hello Steven,
Before we looking into depth of your code logic or your web shop, I'd
like
to confirm whether this is a environment specific problem. Based on my
local test, I can read and update Sessionstate(sqlserver mode) in the
aspx
inline code.


I had to add

<%@Page Debug="true" enablesessionstate="true" validateRequest="false"
Language="C#" %>
<%@Import Namespace="System.Web"%>
<%@Import Namespace="System.Web.SessionState"%>

to your code, to make it work, but everything is workin there with
sqlserver mode.
The guess I had is that it might be, cause we are defining really many
session-variables
in the whole project, there might be any limit, we reached after which
values get lost
or so, cause there is not any code mattering these session-variables
before in the page
and there is no session abandon or so.
Hopefully this helps you at least a bit ;)
Steve
Nov 19 '05 #7
Thanks for yoru reply.

Then, since this is a project/environment specific problem, it'll be hard
to repro it on ourside. Curerntly I'll lookup some former issues to see
whether there're any similiar problem with the one you encountered or
whether there're any known problems with SQL Session when using a lot of
session variables. I'll come back to you soon.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #8
Hi Steve,

After reviewing some former issues, I didn't found any existing patterns
which will cause the problem you mentioned, also there're no limit for the
quantity of sessionState varialbes. From existing cases, I only found
someone who lose sessionstate when there're certain exceptions occur in
application(not specific to sqlserver mode) or when using in webfarm
scenario).....
So I think this is a environment/code specific problem. Due to the
limitation of the newsgroup, if you feel it an urgent issue, I'd suggest
you contact the PSS for some more thorough troubleshooting.

http://support.microsoft.com/default.aspx?scid=sz;en-us

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: BobJohn | last post by:
I've been having a very weird problem for a while now. About 1% of the time, people lose their sessions. Through logging I have discovered that a lot of these people are getting 2 conflicting...
5
by: David Shorthouse | last post by:
Hey folks, I have IIS running on a dynamic IP so have had to make use of www.dyndns.org to make sure that a call to the site's WWW address will make it to the appropriate IP. There is an option...
2
by: Steve Remer | last post by:
OK, I think I understand session state pretty well. I've done additional research on Google over the last few days to fill in any holes. To begin with, I'm using StateServer and not InProc for...
1
by: Steve Remer | last post by:
My application (relevant code snippets below) originally used Session variables in order to maintain state from page to page. After being unable to solve the mystery of why those variables were...
14
by: Michael Carr | last post by:
I have an intermittent problem that occurs on a very small number of browsers that access my website. The strange thing is this: my site works perfectly for 99.9% of browsers. The behavior...
2
by: Ricky K. Rasmussen | last post by:
Hi NG, We have a rather large ASP.NET application that uses popups to display various dialogs to the user. In our work we've come over a rather annoying "bug": If we open a modal dialog using...
3
by: Billy Horne | last post by:
Hi - I need to write a basic order page for our web site. It is very straight-forward, in that we don't need a whole "shopping cart" system. Instead we just need a list of products displayed with...
4
by: Chris | last post by:
When a request comes into a page on my ASP.net site and a session is not found, I want to detect whether the request is an initial request or if the user did have a session going that has now been...
4
by: Urs | last post by:
Two questions: 1) What possibly causes HttpApplication from being unloaded or recycled? 2) How can I prevent HttpApplication from being unloaded or recycled (to prevent loss of session state...)...
4
by: leena13 | last post by:
Hi, I am facing a problem of loss of session variables once the ASP.Net 2.0 application is deployed. Let me add that this is actually a 1.1 to 2.0 migration. I found that the first time the...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.