473,587 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lose Session Variables

I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my pages I set a date in a dropdownlist (autopostback=f alse) and then click a "Build" button which builds a report. Most of the time there is no problem. But sometimes the following happens. I step through the code no problem, the session variables do not change. But, when examined after the the next mouse click, the session variables are GONE! It has nothing to do with time or antivirus protection. Any ideas

Thanks

Michael
Nov 18 '05 #1
10 1700
Check out the sessionid value to make sure the session changed...

AFAIK it can happens also if the application automatically restarted server
side...

Patrice

--

"Michael SL" <mi************ *****@compuware .com> a écrit dans le message de
news:D7******** *************** ***********@mic rosoft.com...
I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my
pages I set a date in a dropdownlist (autopostback=f alse) and then click a
"Build" button which builds a report. Most of the time there is no problem.
But sometimes the following happens. I step through the code no problem,
the session variables do not change. But, when examined after the the next
mouse click, the session variables are GONE! It has nothing to do with time
or antivirus protection. Any ideas?
Thanks,

Michael


Nov 18 '05 #2
Will you post some code so we can see what is going on?
Nov 18 '05 #3
Added informatio

I am using Visual Studio. I have set up some breakpoints. When I hit the breakpoints I click on the breakpoints filled circle indicator and it turn into the empty circle (meaning that the breakpoint is temporarily disabled for this execution). Now, the code continually passes over the disabled breakpoint until I set TheStartDate to some particular values and perform a Build. The next time the code hits the breakpoint it stops. This indicates that Visual Studio did do a reset. But why I have no idea. As stated before, it is not time. I do not see anything it the code which would cause it. I just don't get it

Michae

----- Michael SL wrote: ----

I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my pages I set a date in a dropdownlist (autopostback=f alse) and then click a "Build" button which builds a report. Most of the time there is no problem. But sometimes the following happens. I step through the code no problem, the session variables do not change. But, when examined after the the next mouse click, the session variables are GONE! It has nothing to do with time or antivirus protection. Any ideas

Thanks

Michael
Nov 18 '05 #4
Do you mean this is when perform a build ? It updates the DLL in your /bin
folder which is likely to restart the application.

Do you have the same behavior when you just test your application using
simply the browser ?

--

"Michael SL" <mi************ *****@compuware .com> a écrit dans le message de
news:57******** *************** ***********@mic rosoft.com...
Added information

I am using Visual Studio. I have set up some breakpoints. When I hit the breakpoints I click on the breakpoints filled circle indicator and it turn
into the empty circle (meaning that the breakpoint is temporarily disabled
for this execution). Now, the code continually passes over the disabled
breakpoint until I set TheStartDate to some particular values and perform a
Build. The next time the code hits the breakpoint it stops. This indicates
that Visual Studio did do a reset. But why I have no idea. As stated
before, it is not time. I do not see anything it the code which would cause
it. I just don't get it.
Michael

----- Michael SL wrote: -----

I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of
my pages I set a date in a dropdownlist (autopostback=f alse) and then click
a "Build" button which builds a report. Most of the time there is no
problem. But sometimes the following happens. I step through the code no
problem, the session variables do not change. But, when examined after the
the next mouse click, the session variables are GONE! It has nothing to do
with time or antivirus protection. Any ideas?
Thanks,

Michael


Nov 18 '05 #5
2ND ATTEMP AT REPLY - FOR SOME REASON MY PREVIOUS REPLY DID NOT POST

There is a ton of code but I will give you some of it. If you need more, let me know.

From the aspx file:
<asp:dropdownli st id="TheStartDat e" runat="server" AutoPostBack="F alse" Width="120px"></asp:dropdownlis t><asp:dropdown list id="TheEndDate " runat="server" AutoPostBack="F alse" Width="120px"></asp:dropdownlis t><asp:button id="btnBuild" runat="server" Text="Build"></asp:button><Tex tArea id="Summary" onmouseup="SumM ouseUp()" onkeyup="SumMou seUp()" style="WIDTH: 90%" name="Summary" rows="25" runat="server"> </TextArea>

From the login aspx.vb file:
Dim tempStr As String
tempStr = Me.TemplateSour ceDirectory
Session("Top") = "\" + Right(tempStr, Len(tempStr) - 1)

From the button processing aspx.vb file:
Private Sub btnBuild_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnBuild.Click
Dim EndDate As Date
Dim sEndDate As String
Dim sStartDate As String
Dim StartDate As Date

Msg.Text = ""

sStartDate = TheStartDate.Se lectedValue
sEndDate = TheEndDate.Sele ctedValue

StartDate = CType(sStartDat e, DateTime)
EndDate = CType(sEndDate, DateTime)

If EndDate >= StartDate Then
BuildSummary(St artDate, EndDate)

btnAddBuild.Vis ible = True
btnAddBuild.Ena bled = True
btnFinalize.Ena bled = True
btnFinalize.Vis ible = True
btnSave.Enabled = True
lblReportName.V isible = True
SaveReportName. ReadOnly = False
SaveReportName. Visible = True
Summary.Attribu tes.Remove("rea donly")
Summary.Visible = True
btnSave.Visible = True

Else
Msg.Text = "Invalid Selection: End Date cannot be earlier than Start Date."
End If
End Sub 'btnBuild_Click

The 'BuildSummary' function is quite complex. It creates and fills tables as well as accessing an Access Database and uses the results to build summary.value. I do not have any idea what in the code would cause a restart but with the right data if happens consistantly.
Nov 18 '05 #6
Patrice

Whenever I execute from Visual Studio it rebuilds the application (updating the DLL) and runs. Now when I process with certain data I lose my session variables. The same thing happens if I access the web page from another PC. It works fine until I build a report using a different start date. After that the session variables are lost.

Michael

----- Patrice Scribe wrote: -----

Do you mean this is when perform a build ? It updates the DLL in your /bin
folder which is likely to restart the application.

Do you have the same behavior when you just test your application using
simply the browser ?

--

"Michael SL" <mi************ *****@compuware .com> a écrit dans le message de
news:57******** *************** ***********@mic rosoft.com...
Added information
I am using Visual Studio. I have set up some breakpoints. When I hit the breakpoints I click on the breakpoints filled circle indicator and it turn
into the empty circle (meaning that the breakpoint is temporarily disabled
for this execution). Now, the code continually passes over the disabled
breakpoint until I set TheStartDate to some particular values and perform a
Build. The next time the code hits the breakpoint it stops. This indicates
that Visual Studio did do a reset. But why I have no idea. As stated
before, it is not time. I do not see anything it the code which would cause
it. I just don't get it. Michael
----- Michael SL wrote: -----
I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of
my pages I set a date in a dropdownlist (autopostback=f alse) and then click
a "Build" button which builds a report. Most of the time there is no
problem. But sometimes the following happens. I step through the code no
problem, the session variables do not change. But, when examined after the
the next mouse click, the session variables are GONE! It has nothing to do
with time or antivirus protection. Any ideas? Thanks,
Michael

Nov 18 '05 #7
New Informatio

I have narrowed it down to one small bit of code
Public Class AdministratorRe por
..
Dim AssignDT As DataTabl
..
Private Sub BuildSummary(By Val StartDate As Date, ByVal EndDate As Date, Optional ByVal IsAdd As Boolean = False
..
Dim dc As DataColum
Dim dr As DataRo
..
AssignDT = New DataTabl

dc = New DataColumn("Pro jectID"
AssignDT.Column s.Add(dc

dc = New DataColumn("Emp Name"
AssignDT.Column s.Add(dc

dc = New DataColumn("Dat e"
AssignDT.Column s.Add(dc

..
If ... The
..
dr = AssignDT.NewRow (
dr("ProjectID" ) = reader1(0
dr("EmpName") = reader1(1
dr("Date") = DBDat
AssignDT.Rows.A dd(dr
..
End I

If a button click causes the AssignDT.Rows.A dd(dr) to execute 7 or less times, it works just fine. If that same button click causes the AssignDT.Rows.A dd(dr) to execute more than 7 times after posting I lose my session variables. I have tried inserting an AssignDT.Accept Changes() after the .Rows.Add, it did not help. Any Ideas

Thanks

Michael
Nov 18 '05 #8
Ignore the previous posting. This seems to be a timing issue. If I place a breakpoint within the loop that processes the DataTable, IT WORKS JUST FINE. If I let it run full speed, IT FAILS. Now I have to try to figure a way to slow it down - ANY SUGGESTIONS?
Nov 18 '05 #9
Xis
Hi Michael,

I'm having similar problem.

I'm using session variables to store user data. I can go to several pages
and session remain. But with one page, where I create a datagrid, after load
first time this page session still are there, if I click or refresh anywhere
in the page, session variables are lost, but session ID still remain.

Do you have any idea about my problem?

"Michael SL" <mi************ *****@compuware .com> escribió en el mensaje
news:D7******** *************** ***********@mic rosoft.com...
I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my
pages I set a date in a dropdownlist (autopostback=f alse) and then click a
"Build" button which builds a report. Most of the time there is no problem.
But sometimes the following happens. I step through the code no problem,
the session variables do not change. But, when examined after the the next
mouse click, the session variables are GONE! It has nothing to do with time
or antivirus protection. Any ideas?
Thanks,

Michael

Nov 18 '05 #10

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

Similar topics

6
2380
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an email from (possibly) three seperate forms. the following code is the end of a routine which stashes data from the first form off to session...
6
656
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter, but I can't get the value is stored in it. How can I do that? Thanks a lot!
4
5578
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the immediate window will show the values in Session after the relevant lines that set the variables in the Page_Unload event. However, on postback, these...
31
6980
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily using Session variables for three years now and i'm entering a project with my new boss who has never quite come around that session variables are...
3
2896
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have any experience on how to keep track of session value. Any help it's appreciated. Thanks Alan
2
2006
by: Tomas Martinez | last post by:
Hi, Well, my problem is so simple as it says in the subjet but very frustrating also. I have a project and it is losing the session variables with each postback, so I downloaded from the web a project which used a session management dll to discover what was wrong in my project. This web project has two pages, one send to the other a...
18
3426
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts...
26
3592
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user opens a new IE window with Ctrl-N or File-New-Window, BOTH WINDOWS SHARE THE SAME SESSION VARIABLES. This cannot be prevented.
7
1922
by: robert.waters | last post by:
Why do my public variables (including class instances) disappear when my app experiences an unhandled error? My custom class module's class_terminate event doesn't even fire, the instance just goes out of scope/gets garbage collected/disappears into thin air. Does anyone know why Access behaves in this manner, or more importantly how to...
0
7923
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...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8221
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...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5719
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...
0
5395
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...
0
3845
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...
1
2364
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
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.