473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1684
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.C ount - 1)
post_vars.Add(R equest.Form.Get Key(i), Request.Form(i) .ToString)
next

...

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

...

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

...

</html>
<%
Response.Write( Session("keywor d") & " <-> " & 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("keywor d") & " <-> " & 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.C ount - 1)
post_vars.Add(R equest.Form.Get Key(i), Request.Form(i) .ToString)
next

...

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

...

if IsNothing(Sessi on("keyword")) = false then
if post_vars.Item( "keyword") <> Session("keywor d") then
Session("keywor d") = post_vars.Item( "keyword")
end if
else
Session.Add("ke yword", post_vars.Item( "keyword"))
end if
Response.Write( Session("keywor d") & " <-> " & 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.m icrosoft.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("keywor d") & " <-> " & 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.C ount - 1)
post_vars.Add(R equest.Form.Get Key(i), Request.Form(i) .ToString)
next

...

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

...

if IsNothing(Sessi on("keyword")) = false then
if post_vars.Item( "keyword") <> Session("keywor d") then
Session("keywor d") = post_vars.Item( "keyword")
end if
else
Session.Add("ke yword", post_vars.Item( "keyword"))
end if
Response.Write( Session("keywor d") & " <-> " & 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(sq lserver mode) in the aspx
inline code. Here is my test page:

=============== =============== ====
<HTML>
<HEAD>
<title>inlineSe ssionProcess</title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.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(sq lserver mode) in the
aspx
inline code.


I had to add

<%@Page Debug="true" enablesessionst ate="true" validateRequest ="false"
Language="C#" %>
<%@Import Namespace="Syst em.Web"%>
<%@Import Namespace="Syst em.Web.SessionS tate"%>

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
2574
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 session id's. What is throwing me for a loop is this: Lets call the session id's aaaaa and bbbbb session_name() is standard, "PHPSESSID" session_id() is aaaaa the URL contains no session info the session cookie $_COOKIE is bbbbb
5
3592
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 in the www.dyndns.org account settings to mask a redirect, which essentially makes a frameset and hides the actual WWW address. This is a nice feature, but the problem is I have a number of asp forms that permit posting data to an Access database...
2
2585
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 SessionState mode in my web.config. In fact, that's the only mode Verio shared hosting supports. That should eliminate about 70% of the reasons Session objects get destroyed from what I can tell.
1
3172
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 intermittently inaccessible, (all Session variables gone, not using InProc Session state mode), I moved to a cookies-based solution. Now I have cookie contents that are intermittently inaccessible. Someone suggested using session variables to...
14
2062
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 described below occurs for 0.1% of users, and so far I've only seen it on IE 6.0. My ASP.NET website is set up like this: 1. Logon page - Collect username / password and verify against the DB. If OK, store the UserID in Session and redirect to Main...
2
4929
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 the javascript command window.showModalDialog() we loose the current Session if a new window is opend from within the modal one (using the window.open() method). The "funny" thing is that this only occurs if another instance of IE has been
3
1414
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 a quantity field, and when they submit the form it then collects payment info, then they submit again and it charges their card. I plan to use a third party component to handle the credit card charging so that should be pretty easy. My main...
4
2752
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 lost and show an explanatory message before restarting the session. Rather than tagging a 'session in progress' flag on the end of every request querystring I'd like to detect it using data sent in every request. One idea I had was that when...
4
1339
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...) ? Thanks for any hints. Urs
4
2831
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 page is posted, I found that session variables are getting lost. When I hit Back on IE, and re-enter, the session variables exist and things move smoothly. This problem was not occurring when I tested on my machine, but only after deployment to the...
0
8010
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7942
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8429
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8300
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5963
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5461
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3922
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3969
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.