Newbie question ( global variable definition page? )

Discussion in 'ASP .Net' started by Dan, Oct 29, 2003.

  1. Dan

    Dan Guest

    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?
     
    Dan, Oct 29, 2003
    #1
    1. Advertising

  2. Dan

    e Guest

    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")

    "Dan" <> wrote in message
    news:031701c39e4a$b8b5b330$...
    > 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, Oct 29, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jianli Shen
    Replies:
    1
    Views:
    647
    Victor Bazarov
    Mar 13, 2005
  2. Replies:
    1
    Views:
    406
    Michael Ekstrand
    Aug 21, 2005
  3. Bram Kuijper
    Replies:
    7
    Views:
    2,045
    James Kanze
    Jun 28, 2007
  4. Pierre Yves
    Replies:
    2
    Views:
    526
    Pierre Yves
    Jan 10, 2008
  5. Sam Kong
    Replies:
    2
    Views:
    192
    Joel VanderWerf
    May 25, 2005
Loading...

Share This Page