HTTP_HOST in global.asax

  • Thread starter Greg Collins [Microsoft MVP]
  • Start date
G

Greg Collins [Microsoft MVP]

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!
 
G

Greg Collins [Microsoft MVP]

Never mind - I found it:

HttpContext.Current.Request.Url.Host;
 

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,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top