0

This is a Vb.NET 4.0 framework web application which is deployed over iis.

I have a welcome label on my page which will display a different message based on the what the client PC name is. The problem is that I either obtain the webserver hostname/Ip address or I receive an error "No such host is known"

Here are the different methods that have been attempted with their varying error messages.

Thanks for looking

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Try

        'No such host is known Error
        'WelcomeMessage.Text = System.Net.Dns.GetHostEntry(Request.UserHostName).ToString
        'WelcomeMessage.Text = (Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName.ToString)
        'WelcomeMessage.Text = System.Net.Dns.GetHostEntry(Request.ServerVariables("REMOTE_HOST")).HostName

        'I receive the IPv6 ID
        'WelcomeMessage.Text = Request.UserHostAddress

        'I receive the web Server ID
        'WelcomeMessage.Text = System.Net.Dns.GetHostName()\

    Catch ex As Exception
        WelcomeMessage.Text = ex.Message

    End Try


End Sub
miggy
  • 75
  • 8
  • You're getting the web server info because the application is running from the web server (server-side). To get information about the client you would need something running in the browser (client-side). AFAIK you can't get this through javascript (at least I'd hope not). You would probably need something like Java to do what you're looking for. – user2051770 Nov 03 '14 at 19:55
  • You can get the IP but not the computer name. – Steve Nov 03 '14 at 21:30
  • possible duplicate of [How can I read the client's machine/computer name from the browser?](http://stackoverflow.com/questions/922476/how-can-i-read-the-clients-machine-computer-name-from-the-browser) – DWRoelands Nov 04 '14 at 13:10
  • It is very similar to that post @DWRoelands mentioned. I'm working my way through understaind a reverse DNS lookup. I have configured my web server/iis to allow the Reverse DNS lookup and I am able to return an IP address. Thanks to all. – miggy Nov 04 '14 at 14:45

0 Answers0