Skip to content
ASP .NET page that displays your IP address.
JavaScript Other
Find file
New pull request


just goofing off with ASP .NET and HttpContext.Current.Request.ServerVariables

Note: If you run this on your local machine you will get as a result.


Navigate to the page and your IP address will be displayed.


private string GetExternalIp() {
    string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
    if (String.IsNullOrEmpty(ip)) {
        ip = Request.ServerVariables["REMOTE_ADDR"];
    return ip;


Copyright (c) 2011 Robert Greiner. See LICENSE for details.

Something went wrong with that request. Please try again.