greg938d72 greg938d72 - 1 month ago 13
Vb.net Question

How do I get a user's ip address with .NET code?

How do I get a user's IP address with .NET code? I'm using Foo Basic Web Studio IDE that uses ASP.net code.

Answer

Here is the way you can that IP address of users.

string clientIp = Request.ServerVariables("HTTP_X_FORWARDED_FOR");

if(string.IsNullOrEmpty(clientIp))
       clientIp = Request.ServerVariables("REMOTE_ADDR")