Webforms Global Varioable and functions

peterdoherty

Well-known member
Joined
Feb 24, 2003
Messages
49
Is there anyway to have a funtion or a variable global to all the asp pages and/or aspx.vb code pages for a single web application?

Also is there anyway to share variable between the asp page and its back end vb page?

Cheers

Peter
 
You can use Module, like what we did in VB6, public function in Module can access anyway.

Another way is use Cookies or HTTP Session to keep your values. I think it is the better way... of course depend on what value your want to keep.
 
Theres no need for a module. You can store the values in a shared class which is imported to each page, or in the applications web.config file. Both methods have their advantages.
 
No, I wouldnt recommend placing values that arent constant in web.config. Of course the values can be changed, rather easily, since a web.config file is XML. However, using a shared method of a class that saves the data to a database, session object or cookie would be a much more appropriate method.
 
Back
Top