473,782 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Variable Madness

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_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles lbtnSubmit.Clic k
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_us ername") = txtUsername.Tex t.ToUpper()
Response.Redire ct("acchist.asp x")
End If
End Sub
*************** *************** *************** *************** *************
On the next/called page "acchist.as px" I assign the session variable
to the text of lblUser.
*************** *************** *************** *************** *************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_us ername")
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
2 1499
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.goo gle.com...
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_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles lbtnSubmit.Clic k
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_us ername") = txtUsername.Tex t.ToUpper()
Response.Redire ct("acchist.asp x")
End If
End Sub
*************** *************** *************** *************** *************
On the next/called page "acchist.as px" I assign the session variable
to the text of lblUser.
*************** *************** *************** *************** *************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_us ername")
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
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.goo gle.com...
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_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles lbtnSubmit.Clic k
Dim bolLogin As Boolean

If Page.IsValid Then
Session("ctc_us ername") = txtUsername.Tex t.ToUpper()
Response.Redire ct("acchist.asp x")
End If
End Sub
*************** *************** *************** *************** *************
On the next/called page "acchist.as px" I assign the session variable
to the text of lblUser.
*************** *************** *************** *************** *************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

If Page.IsPostBack Then

Else
lblUser.Text = Session("ctc_us ername")
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3351
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option Explicit and Response.Expires=-1,
1
3113
by: Ann Leland | last post by:
I have been using session variables to pass a user name from one ASP page to another inside framesets for 9 months and it stopped working this week. I have made no code changes but there was a "security update" installed on the server a few days ago but I can't find out exactly what it was. In the research I have done I found many articles on the subject of session variables in ASP pages inside framesets. From what I read a new...
166
8675
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
4
1660
by: VB Programmer | last post by:
If I have a variable I want to share in my application what is the difference between just declaring a variable (Dim strMyVar as String) and using a session variable (Session("strMyVar"))? When should I use a session variable and when should I just declare it like normal? Thanks in advance!
9
2386
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use - perhaps I'm just not very smart or perhaps MS is making this too hard for us sql bunnies to understand - I dunno, but I'd really appreciate someone explaining what I'm doing wrong here & perhaps suggest a better approach.. I'm familiar with use of...
4
1953
by: T Ralya | last post by:
I am told that ASP.NET controls the session ID and session variables, but that does not fit my symptoms. I am posting here as directed. I'm hoping that someone can at least recommend something to try to isolate the problem. I have a simple application that demonstrates my problem. Page 1, step1: SaveSessionVariableButton will create a string value, show it on screen, save it in a session variable and show the session ID on screen....
3
2912
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
7
2046
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below, it retreives the Menu from session and assigns its reference to Menu1. Within the Page_Load event I can see its internal values which have been retreived for each menu item and so it looks good. However, when the Render method is called of...
2
2084
by: ras26 | last post by:
I have a WebSite "App1" which has an external assembly "Lib1". Inside this external assembly we have developed some classes that derive from "System.Web.UI.Page". One of these pages is called "WebNotification". In the WebSite "App1" we create an instance of "WebNotification", but when this class tries to access some Session variables it generates the following error: Session state can only be used when enableSessionState is set to...
0
9639
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
9479
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
9942
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
8967
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...
0
6733
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
5378
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
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
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
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.