Global Variables

PeteN

Member
Joined
Feb 25, 2008
Messages
6
Programming Experience
Beginner
Tool is Visual Studio 2005 (vb.net 2005)
I have been trying to find information on how to store, update and use global variables in an intranet enviroment.

Reading threads and documents I understand that you can place a global variable in the 'web.config' file and update it from a web page. How?

If someone could help me out with the the secnerio below that will give me a great insite into how it all works and i can build from that

What I'm trying to do is when a user logs on to the intranet site, I want to hold their name in a global variable and be able to retrieve it to display it on each web page they visit within the intranet site. I need help in understanding how to do this and the best practice.

meny thanks
 

evad4682

Well-known member
Joined
Nov 7, 2005
Messages
55
Programming Experience
Beginner
You may want to look up information on session variables but here is how I would try to do it.

On some event, either a click event or a page load, declare a session level variable:

VB.NET:
Session("variableName") = txtTextBox.text

Then on other pages you can call that session variable by name:

VB.NET:
lblLabel.text=Session("variableName")

Hope that helps
 
Top Bottom