Newbie question ( global variable definition page? )

D

Dan

in my series of asp.net c# pages, I wish to create one
page that will just contain various variables. Similar to
the application.cfm page in coldfusion. how is this done?
 
E

e

From the Global.asax file, you can assign key/value items to the Application
or Session (please excuse the VB, I'm unfamiliar with C# syntax)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'If you change this, you change it for everyone
Application.Add("EveryonesPie", 3.14)
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
'If you change this, you change it for this particual user's session
Session.Add("ThisUsersPie", 3.14)
End Sub

Then reference them wherever you need to:

myPie = Session.Item("ThisUsersPie")
theirPie = Application.Item("EveryonsPie")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top