Couldn't find the UserHostName property on HttpRequest. And nothing about it in any forums. Has this been dropped? Any idea?
The accepted answer is not correct. someHttpContext.Request.Host
corresponds to the Host
header used in the HTTP request. For example: fetching http://example.org/test will result in example.org
.
UserHostName
used to return the DNS hostname of the client IP address making the request (which is someHttpContext.Connection.RemoteIpAddress
). It looks as though the only recourse is to manually resolve the DNS hostname from the IP address with e.g. Dns.GetHostEntry
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With