hostname and dns

S

Spartaco

hi, I was curious to know why the property Request.UserHostName gives me the
IP of visitors instead of their dns name as stated in the documentation.
It's something wrong with the configuration of my server(win2003) or it's
always this way ?

I think it's a problem of my server, so if you confirm my though, how can I
distinguish by code if this property is returning an ip or a dns name?

thanks to everybody
 
M

MattC

I think (dont take it as 100%) that with anonymous access user credentials
are not challenged, as in the server will not ask for them, so the only
thing available is IP.

MattC
 
P

Patrice

If I remember, this is a server setting (it returns the IP because
resolution may slow down a bit each request).

You have basically two options :
- change the server setting to resolve the name for each request (see the
KB)
- resolve this yourself as needed (System.Net.Dns allows to do that).

Patrice
 
S

Spartaco

thanks Patrice I thought was something like that, I'm going to use the Dns
class to resolve the hostname, anyway how can I know if that property
contains an ip address (v4 or v6) or a dns name?

maybe when

Request.UserHostAddress != Request.UserHostName ? dns : ip

thanks
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top