HTTP_HOST in global.asax

Discussion in 'ASP .Net' started by Greg Collins [Microsoft MVP], Jun 21, 2006.

  1. Is there a way to get the HTTP_HOST value in the Application_Start event handler in global.asax?

    I have multiple sites running from the same hosted service, and want to keep track of current visitors for each site separately.

    My intention was to get the HTTP_HOST value, and use that with an Application variable to store current visitors to the specific site.

    Is there some other/better way to do this? Right now I'm getting an error that the Request object is not available in this context.

    Thanks!

    --
    Greg Collins [Microsoft MVP]
    Visit Brain Trove ( http://www.BrainTrove.com )
    Greg Collins [Microsoft MVP], Jun 21, 2006
    #1
    1. Advertising

  2. Never mind - I found it:

    HttpContext.Current.Request.Url.Host;

    --
    Greg Collins [Microsoft MVP]
    Visit Brain Trove ( http://www.BrainTrove.com )
    Greg Collins [Microsoft MVP], Jun 21, 2006
    #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. Trapulo
    Replies:
    2
    Views:
    5,321
    Trapulo
    Sep 8, 2004
  2. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

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

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,139
    Mark Rae
    May 23, 2006
  4. Paul Smith
    Replies:
    9
    Views:
    153
    Don Verhagen
    Sep 8, 2003
  5. JT
    Replies:
    4
    Views:
    250
    Ray at
    Feb 20, 2004
Loading...

Share This Page