Global.asax in asp.net 2.0

Discussion in 'ASP .Net' started by Arjen, Aug 1, 2005.

  1. Arjen

    Arjen Guest

    Hi,

    How can I make some variables global (public available) with the global.asax
    file inside asp.net 2.0?

    - I want to access these variables from code-behind files (and maybe from
    aspx files).
    - The global.asax haves no code-behind file.
    - I want to set the values of the public variables inside the
    Application_BeginRequest method.

    Thanks!
     
    Arjen, Aug 1, 2005
    #1
    1. Advertising

  2. Arjen

    Guest

    I think that you want a variable that is global within the scope of a page.
    If that's what you want use
    HttpContext.Current.Items in your external class files
    or
    Context.Items in your aspx & global.asax file

    An overview of global data in asp.net can be found here :
    http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/

    I hope it helps...
    Let me know if you have any more questions..

    Cheers,
    Tom Pester

    > Hi,
    >
    > How can I make some variables global (public available) with the
    > global.asax file inside asp.net 2.0?
    >
    > - I want to access these variables from code-behind files (and maybe
    > from
    > aspx files).
    > - The global.asax haves no code-behind file.
    > - I want to set the values of the public variables inside the
    > Application_BeginRequest method.
    > Thanks!
    >
     
    , Aug 1, 2005
    #2
    1. Advertising

  3. On Mon, 1 Aug 2005 23:30:23 +0200, "Arjen" <>
    wrote:

    >Hi,
    >
    >How can I make some variables global (public available) with the global.asax
    >file inside asp.net 2.0?
    >


    use the static Application class. Here is an example of what might go
    in the global.asax file:

    Application["Q"] = new BlackHen.Threading.WorkQueue(rrQ);

    And, in your codebehind to reference the class:

    WorkQueue wq = ((WorkQueue)Application["Q"]);


    This is as close to making a global as I know how to do. Hope this
    helps.





    Peter Kellner
    http://peterkellner.net
     
    Peter Kellner, Aug 2, 2005
    #3
  4. Arjen

    Arjen Guest

    Okay, thanks for the link!
    Arjen


    <> schreef in bericht
    news:...
    >
    > I think that you want a variable that is global within the scope of a
    > page.
    > If that's what you want use HttpContext.Current.Items in your external
    > class files
    > or
    > Context.Items in your aspx & global.asax file
    >
    > An overview of global data in asp.net can be found here :
    > http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/
    >
    > I hope it helps...
    > Let me know if you have any more questions..
    >
    > Cheers,
    > Tom Pester
    >
    >> Hi,
    >>
    >> How can I make some variables global (public available) with the
    >> global.asax file inside asp.net 2.0?
    >>
    >> - I want to access these variables from code-behind files (and maybe
    >> from
    >> aspx files).
    >> - The global.asax haves no code-behind file.
    >> - I want to set the values of the public variables inside the
    >> Application_BeginRequest method.
    >> Thanks!
    >>

    >
    >
     
    Arjen, Aug 2, 2005
    #4
    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. VSK
    Replies:
    1
    Views:
    790
    Alvin Bruney
    Jul 29, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    6,882
    Daniel Bass
    Dec 31, 2003
  3. 2obvious

    no global constants in global.asax?

    2obvious, Sep 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,830
  4. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    841
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  5. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,165
    Mark Rae
    May 23, 2006
Loading...

Share This Page