How To Get IP Address in C#

Last Updated 3/27/2017

Get the visitor's IP address in C#

Whenever a browser sends a request for a page, it also sends a number of other headers to the script, containing information such as the browser type. It also includes information such as the visitors IP address.

In C# you can get the IP address of your users from the Request.ServerVariables collection. The following C# code will display the visitor’s IP:

<%Response.Write(Request.ServerVariables["REMOTE_ADDR"]);%>

To find sample programming code and tutorials how to get the visitor's IP address in ASP, ASP.NET, VB.NET, PHP, JAVA, JavaScript and Perl check here: