Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is Request.UserHostAddress reliable?
Message
 
 
To
19/08/2009 16:11:06
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01418265
Message ID:
01419074
Views:
43
>>>>Hi,
>>>>
>>>>I need to log IP of the user who is using my ASP.NET application (access is anonymous). I found (by Googling) the call to Request.UserHostAddress as a way to get the IP. It works on my notebook where I see "127.0.0.1". How reliable this approach is when the user will be accessing the application on real Intranet or Internet?
>>>>
>>>>Thank you in advance for your help.
>>>
>>>It works fine. The only "issue" is that if the people are behind a NAT firewall you will see the address of the firewall, not the user. For example, my IP address is 192.168.1.100 and I hit a website. The website will see the address of our firewall which is 12.*.*.* (not the 192.*.*.* address). All users behind that firewall will appear to come from the same addres. I say "issue" because some people mistake this for a problem when it's exactly the correct behavior.
>>
>>I actually have to check my customers site to see if there are any error messages in the log file. And it will show me the IPs if there were read. Everybody who is using this application is on an Intranet (withing the company) so I am not sure how useful the IP will be in the error log. But I thought I will try to collect all possible information.
>>Thank you for your message.
>
>If you are running your logging on the inside of the firewall and the users are inside the firewall (Intranet as you say) then the NAT shouldn't be invovled. I think Paul was indicating this for typical Internet access where all the users of a network are behind a firewall and accessing the web site outside the network.
>Tim

Thank you for clarifying it.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform