Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharing Info Among Web Pages and Classes

Status
Not open for further replies.

tonylmiller

Programmer
Apr 18, 2002
16
US
I'm just wondering what is the best way to pass info between web pages (several of them) and classes. In a Windows app, I would use a "GlobalVariables" class with public properties, but I don't believe that will work on a webserver.

I need to set a UserID, for example, and it needs to be available to all web pages and also my data layer classes.

Should I use cookies or session variables to share the info between web pages and then pass the UserID back to my data layer within my method parameters? Or is there a better way? Whichever solution is recommended, please provide a link to more information if possible.

Thanks in advance!

Tony
 
If the variables are to be accessible for many application then put these in the Server.
If the variable are specific to one application then use the Cache class, with instances private to each application, and its lifetime is tied to that of the application.
When the application is restarted, the Cache object is recreated and it offers many things to deal with variables wnhe these variables get refreshed.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top