473,703 Members | 2,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Some session variables disappear between postbacks

PJ
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 variables are no longer in
Session. All Session variables that were set previous to that particular
page are still there so I know it's not an issue w/ the aspnet_wp recyclying
or all of the Session variables clearing. I'm totally at a loss as to
what's going on, if anyone has any ideas, I would love to hear them. The
session state is InProc and the values I am setting are simple string
values.

TIA~PJ

Nov 18 '05 #1
4 5587
You must be clearing these variables somewhere. Can you verify by searching
your project folder that this is not the case? Example, find ALL instances
of session and examine them. If all is well, post your code here.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:u8******** ******@TK2MSFTN GP09.phx.gbl...
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 variables are no longer in
Session. All Session variables that were set previous to that particular
page are still there so I know it's not an issue w/ the aspnet_wp recyclying or all of the Session variables clearing. I'm totally at a loss as to
what's going on, if anyone has any ideas, I would love to hear them. The
session state is InProc and the values I am setting are simple string
values.

TIA~PJ

Nov 18 '05 #2
PJ
I am deifnately not clearing any session variables. I've rebuilt the page
piece by piece and it seems to be caused by the DataBind statement on a
repeater in the page. I removed all events associated with the repeater and
set it's DataSource to a simple string array and the same problem still
occurred. If I don't databind the repeater, then the session values I set
in the Page_Unload event are available on PostBack. If I do, it's like the
Session variables were never set. What gives?!!?!
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OZ******** ******@TK2MSFTN GP11.phx.gbl...
You must be clearing these variables somewhere. Can you verify by searching your project folder that this is not the case? Example, find ALL instances
of session and examine them. If all is well, post your code here.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:u8******** ******@TK2MSFTN GP09.phx.gbl...
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 variables are no longer in Session. All Session variables that were set previous to that particular page are still there so I know it's not an issue w/ the aspnet_wp

recyclying
or all of the Session variables clearing. I'm totally at a loss as to
what's going on, if anyone has any ideas, I would love to hear them. The session state is InProc and the values I am setting are simple string
values.

TIA~PJ


Nov 18 '05 #3
post the code. are you doing anything funny/different? any customizations?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:OH******** ******@TK2MSFTN GP12.phx.gbl...
I am deifnately not clearing any session variables. I've rebuilt the page
piece by piece and it seems to be caused by the DataBind statement on a
repeater in the page. I removed all events associated with the repeater and set it's DataSource to a simple string array and the same problem still
occurred. If I don't databind the repeater, then the session values I set
in the Page_Unload event are available on PostBack. If I do, it's like the Session variables were never set. What gives?!!?!
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OZ******** ******@TK2MSFTN GP11.phx.gbl...
You must be clearing these variables somewhere. Can you verify by searching
your project folder that this is not the case? Example, find ALL instances
of session and examine them. If all is well, post your code here.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:u8******** ******@TK2MSFTN GP09.phx.gbl...
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 variables are no
longer in Session. All Session variables that were set previous to that particular page are still there so I know it's not an issue w/ the aspnet_wp

recyclying
or all of the Session variables clearing. I'm totally at a loss as to
what's going on, if anyone has any ideas, I would love to hear them. The session state is InProc and the values I am setting are simple string
values.

TIA~PJ



Nov 18 '05 #4
PJ
The session variable "foldersXml " is the session variable that finds itself
not available during postback.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.SmartNavigat ion = False
If Not Me.IsPostBack Then
If Request("keep") Is Nothing Then
GetData()
Else
RefreshData()
End If
SetupUI()
BindData()
Else
RefreshData()
End If
End Sub

Private Sub Page_Unload(ByV al sender As Object, ByVal e As EventArgs)
Handles MyBase.Unload
Session("folder sXml") = folderList.GetX ml()
Session("choose rList") = Nothing
End Sub

Private Sub SetupUI()
Me.breadCrumbNa v.AddCrumb("Adm in",
Me.ResolveUrl(" ~/admin/adminmain.aspx" ), 1)
Me.breadCrumbNa v.AddCrumb("Fol ders",
Me.ResolveUrl(" ~/admin/folderlist.aspx "), 2)
lblDivision.Tex t = Me.CurrentDivis ion.Name.ToUppe r()
End Sub

Private Sub GetData()
folderList = B2BFolderFactor y.CreateAdminFo lders(Me.Curren tDivision,
Nothing)
End Sub

Private Sub RefreshData()
'refresh the folder list from the xml string of folder id's
Dim foldersXml As String = CType(Session(" foldersXml"), String)
If foldersXml Is Nothing Then
Response.Redire ct(Me.REDIRECT_ URL)
End If
folderList = B2BFolderFactor y.CreateAdminFo lders(foldersXm l)
'resort a folder if requested ( for name changes from detail page )
If IsNumeric(Reque st("resort")) Then
folderList.Reso rtFolder(Conver t.ToInt32(Reque st("resort")))
End If
End Sub

Private Sub BindData()
maxDepth = folderList.GetM axDepth()
rptMain.DataSou rce = folderList
rptMain.DataBin d()
End Sub

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:Om******** ******@TK2MSFTN GP11.phx.gbl...
post the code. are you doing anything funny/different? any customizations?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:OH******** ******@TK2MSFTN GP12.phx.gbl...
I am deifnately not clearing any session variables. I've rebuilt the page
piece by piece and it seems to be caused by the DataBind statement on a
repeater in the page. I removed all events associated with the repeater

and
set it's DataSource to a simple string array and the same problem still
occurred. If I don't databind the repeater, then the session values I set in the Page_Unload event are available on PostBack. If I do, it's like

the
Session variables were never set. What gives?!!?!
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OZ******** ******@TK2MSFTN GP11.phx.gbl...
You must be clearing these variables somewhere. Can you verify by

searching
your project folder that this is not the case? Example, find ALL

instances of session and examine them. If all is well, post your code here.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PJ" <pj***@hotmail. com> wrote in message
news:u8******** ******@TK2MSFTN GP09.phx.gbl...
> 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 variables are no

longer
in
> Session. All Session variables that were set previous to that

particular
> page are still there so I know it's not an issue w/ the aspnet_wp
recyclying
> or all of the Session variables clearing. I'm totally at a loss as to > what's going on, if anyone has any ideas, I would love to hear them.

The
> session state is InProc and the values I am setting are simple string > values.
>
> TIA~PJ
>
>
>



Nov 18 '05 #5

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

Similar topics

5
2569
by: Ben | last post by:
Hello, My $_SESSION variables disappear and reappear. It's not just a matter of not caching the page. I usually have to press the Refresh button about 3 times to get the page to remember the variables. Sometimes refreshing again will cause the variables to disappear again. PHPSESSID will often be empty after using session_start(). Any ideas on how to limit this action? Thanks, Ben
9
3643
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
5
4027
by: Larry Woods | last post by:
I am losing Session variables, but only those that are set in the page previous to a redirect to a secure page. Anyone seen ANY situation where Session variables just "disappear?" Note that OTHER session variables are still intact !?! TIA, Larry Woods
4
3181
by: John Smith Jr. | last post by:
Could someone enlighten me what the difference between viewstate[" and session[" variables in terms of use, performance, and rule of thumb, from what I understand viewstate has overhead to it, and is passed with the page encrypted where session is stored locally in the aspnet_wp.exe process. Also, how do class member variables fit in the mix?
6
1622
by: Jon | last post by:
If a session times out, but the forms auth is still logged in it's possible for users to go to pages on the site that need those session variables. I was under the impression that using forms auth would make it so I would not need to check if session vars were still around. I'm confused! Perhaps someone can clear this up for me? -- ******************************** Jon
7
2071
by: Frank Schumacher | last post by:
Hi NG, I have a weird problem, that's starting to get my sanity. My webapplication stores several values in Session. After a server roundtrip, no Session variables exist anymore (Session.Count is 0) I have logged the Session.SessionID, it is the same as before. I have logged the last and the first line of code in my Codebehind. When
10
3507
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
3
2675
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
4
1888
by: Not Me | last post by:
Hi, I have a set of pages that use forms authentication for access. There are times when one of the session objects I'm using appears to disappear. The session is not timing out, however. (if I go to a page that doesn't use that specific object it works fine and I'm not redirected to the login page) Apologies if I'm using the incorrect terminology.. the session object I'm using is a class of my own, which features several private...
0
8662
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
9243
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8956
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...
0
7853
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6585
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
5922
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
4420
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...
2
2434
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2057
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.