Global Variables

Discussion in 'ASP .Net' started by martin, Dec 5, 2003.

  1. martin

    martin Guest

    Hi,

    where is the best place to keep global variables in asp.net.

    I want to load a value from a database when the application starts. I know
    that i can load this is application_start which is fine. I also know that
    mostly storing a global value in an application variable whould be good,
    like

    application("Variablename") = 5

    However I don't wish to do this because application scope does not scale to
    a web farm.

    should I just do my database call at the start of every page or is there an
    easier way.

    cheers

    martin.
    martin, Dec 5, 2003
    #1
    1. Advertising

  2. martin

    Morgan Guest

    Could you not use the session? That would be independent of a single
    application on a specific server.


    "martin" <> wrote in message
    news:...
    > Hi,
    >
    > where is the best place to keep global variables in asp.net.
    >
    > I want to load a value from a database when the application starts. I know
    > that i can load this is application_start which is fine. I also know that
    > mostly storing a global value in an application variable whould be good,
    > like
    >
    > application("Variablename") = 5
    >
    > However I don't wish to do this because application scope does not scale

    to
    > a web farm.
    >
    > should I just do my database call at the start of every page or is there

    an
    > easier way.
    >
    > cheers
    >
    > martin.
    >
    >
    Morgan, Dec 5, 2003
    #2
    1. Advertising

  3. martin

    martin Guest

    Yes I could use the session, but then I am storing the values once for each
    user. It will work but is not exactly what I had in mind.

    I just want to store a value that all users will be able to access that will
    scale to a web farm.
    maybe storing in the sesion onject is the best way..

    cheers

    martin.


    "Morgan" <> wrote in message
    news:...
    > Could you not use the session? That would be independent of a single
    > application on a specific server.
    >
    >
    > "martin" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > where is the best place to keep global variables in asp.net.
    > >
    > > I want to load a value from a database when the application starts. I

    know
    > > that i can load this is application_start which is fine. I also know

    that
    > > mostly storing a global value in an application variable whould be good,
    > > like
    > >
    > > application("Variablename") = 5
    > >
    > > However I don't wish to do this because application scope does not scale

    > to
    > > a web farm.
    > >
    > > should I just do my database call at the start of every page or is there

    > an
    > > easier way.
    > >
    > > cheers
    > >
    > > martin.
    > >
    > >

    >
    >
    martin, Dec 5, 2003
    #3
    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. Wayne
    Replies:
    2
    Views:
    459
    Wayne
    Nov 11, 2003
  2. jubelbrus
    Replies:
    5
    Views:
    602
    JohnQ
    Jul 20, 2007
  3. mark4asp
    Replies:
    1
    Views:
    206
  4. Tony Archer

    Global Variables? Multi-Application Variables?

    Tony Archer, Nov 24, 2003, in forum: ASP General
    Replies:
    5
    Views:
    212
    Tony Archer
    Nov 25, 2003
  5. king
    Replies:
    2
    Views:
    161
    Tad McClellan
    Jun 27, 2006
Loading...

Share This Page