473,394 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 5570
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**************@TK2MSFTNGP09.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**************@TK2MSFTNGP11.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**************@TK2MSFTNGP09.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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP11.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**************@TK2MSFTNGP09.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.EventArgs) Handles MyBase.Load
Me.SmartNavigation = 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(ByVal sender As Object, ByVal e As EventArgs)
Handles MyBase.Unload
Session("foldersXml") = folderList.GetXml()
Session("chooserList") = Nothing
End Sub

Private Sub SetupUI()
Me.breadCrumbNav.AddCrumb("Admin",
Me.ResolveUrl("~/admin/adminmain.aspx"), 1)
Me.breadCrumbNav.AddCrumb("Folders",
Me.ResolveUrl("~/admin/folderlist.aspx"), 2)
lblDivision.Text = Me.CurrentDivision.Name.ToUpper()
End Sub

Private Sub GetData()
folderList = B2BFolderFactory.CreateAdminFolders(Me.CurrentDivi sion,
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.Redirect(Me.REDIRECT_URL)
End If
folderList = B2BFolderFactory.CreateAdminFolders(foldersXml)
'resort a folder if requested ( for name changes from detail page )
If IsNumeric(Request("resort")) Then
folderList.ResortFolder(Convert.ToInt32(Request("r esort")))
End If
End Sub

Private Sub BindData()
maxDepth = folderList.GetMaxDepth()
rptMain.DataSource = folderList
rptMain.DataBind()
End Sub

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:Om**************@TK2MSFTNGP11.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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP11.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**************@TK2MSFTNGP09.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
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...
9
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...
5
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...
4
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...
6
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...
7
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...
10
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...
3
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...
4
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.