Always 'localhost' from Request.ServerVariables["SERVER_NAME"]

Discussion in 'ASP .Net' started by L Scott, Aug 31, 2004.

  1. L Scott

    L Scott Guest

    I am wanting to get the machine name that is running IIS. I have code in
    the 'Application_BeginRequest' event of the Global.asax and even if I access
    the web site from another machine I am always getting 'localhost' in the
    SERVER_NAME variable. Any way to get the actual machine name?

    LWS
     
    L Scott, Aug 31, 2004
    #1
    1. Advertising

  2. See
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/servervariables.asp
    for the intended meaning of the SERVER_NAME server variable. For the local
    machine name on the server, try using System.Environment.MachineName
    instead.

    HTH,
    Nicole



    "L Scott" <> wrote in message
    news:...
    >I am wanting to get the machine name that is running IIS. I have code in
    > the 'Application_BeginRequest' event of the Global.asax and even if I
    > access
    > the web site from another machine I am always getting 'localhost' in the
    > SERVER_NAME variable. Any way to get the actual machine name?
    >
    > LWS
    >
    >
     
    Nicole Calinoiu, Aug 31, 2004
    #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,376
    Trapulo
    Sep 8, 2004
  2. =?Utf-8?B?aG4=?=
    Replies:
    3
    Views:
    25,656
    John Saunders
    Dec 16, 2004
  3. martin de vroom
    Replies:
    0
    Views:
    256
    martin de vroom
    Jul 30, 2003
  4. E L
    Replies:
    2
    Views:
    363
    Mark J. McGinty
    Mar 1, 2007
  5. Bill
    Replies:
    1
    Views:
    185
    Anthony Jones
    May 3, 2007
Loading...

Share This Page