By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 1,647 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

Session Variable Madness

P: n/a
Here's one that has been stumping people:

I'm writing in ASPX with VB.NET

On the login page I set the entered usename text to a session
variable.
************************************************** **********************
Private Sub lbtnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbtnSubmit.Click
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_username") = txtUsername.Text.ToUpper()
Response.Redirect("acchist.aspx")
End If
End Sub
************************************************** ***********************
On the next/called page "acchist.aspx" I assign the session variable
to the text of lblUser.
************************************************** ***********************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_username")
End If
End Sub
************************************************** ***********************
Here's where the strange behavior starts. In IE6 the session variable
will display in lblUser on the page load. However, if the page is
refreshed the session variable disappears from both lblUser and the
page trace. If the page is repeatedly refreshed the session variable
will begin to alternate as there or not. In Netscape 7.0 the first
time that the called page loads the session variable doesn't appear
and then begins with the smae behavior on repeated refresh.

You can check it out at the following address:
www5dev.nau.edu/ctc/registration/login.aspx
Put in any username and password.

Does anyone know what is causing this and/or how to get the session
variable to remain consistent?

Thanks,
Todd Bohlander
Ancillary Systems Development
Information Technology Services
Northern Arizona University
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Todd,

typically a refresh means that you are no longer in the same session, and so
results in the cache being flushed. why it's reappearing after than I'm not
sure.

Why not assign the name to a text box or a label that has the
EnableViewState enabled (default) and set them visible=false if you don't
want to see them. This should provide more consistency in this case.

hope this helps.
Dan.


"Todd" <rt***@dana.ucc.nau.edu> wrote in message
news:e7**************************@posting.google.c om...
Here's one that has been stumping people:

I'm writing in ASPX with VB.NET

On the login page I set the entered usename text to a session
variable.
************************************************** **********************
Private Sub lbtnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbtnSubmit.Click
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_username") = txtUsername.Text.ToUpper()
Response.Redirect("acchist.aspx")
End If
End Sub
************************************************** ***********************
On the next/called page "acchist.aspx" I assign the session variable
to the text of lblUser.
************************************************** ***********************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_username")
End If
End Sub
************************************************** ***********************
Here's where the strange behavior starts. In IE6 the session variable
will display in lblUser on the page load. However, if the page is
refreshed the session variable disappears from both lblUser and the
page trace. If the page is repeatedly refreshed the session variable
will begin to alternate as there or not. In Netscape 7.0 the first
time that the called page loads the session variable doesn't appear
and then begins with the smae behavior on repeated refresh.

You can check it out at the following address:
www5dev.nau.edu/ctc/registration/login.aspx
Put in any username and password.

Does anyone know what is causing this and/or how to get the session
variable to remain consistent?

Thanks,
Todd Bohlander
Ancillary Systems Development
Information Technology Services
Northern Arizona University
Nov 18 '05 #2

P: n/a
Are you using web farm or web gardening? If so what type of session state
are you using?
"Todd" <rt***@dana.ucc.nau.edu> wrote in message
news:e7**************************@posting.google.c om...
Here's one that has been stumping people:

I'm writing in ASPX with VB.NET

On the login page I set the entered usename text to a session
variable.
************************************************** **********************
Private Sub lbtnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbtnSubmit.Click
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_username") = txtUsername.Text.ToUpper()
Response.Redirect("acchist.aspx")
End If
End Sub
************************************************** ***********************
On the next/called page "acchist.aspx" I assign the session variable
to the text of lblUser.
************************************************** ***********************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_username")
End If
End Sub
************************************************** ***********************
Here's where the strange behavior starts. In IE6 the session variable
will display in lblUser on the page load. However, if the page is
refreshed the session variable disappears from both lblUser and the
page trace. If the page is repeatedly refreshed the session variable
will begin to alternate as there or not. In Netscape 7.0 the first
time that the called page loads the session variable doesn't appear
and then begins with the smae behavior on repeated refresh.

You can check it out at the following address:
www5dev.nau.edu/ctc/registration/login.aspx
Put in any username and password.

Does anyone know what is causing this and/or how to get the session
variable to remain consistent?

Thanks,
Todd Bohlander
Ancillary Systems Development
Information Technology Services
Northern Arizona University

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.