Skip to content

Instantly share code, notes, and snippets.

@azcoov
Created February 19, 2011 17:17
Show Gist options
  • Save azcoov/835198 to your computer and use it in GitHub Desktop.
Save azcoov/835198 to your computer and use it in GitHub Desktop.
MVC Get the users IP Address
string SourceIP = string.IsNullOrEmpty(Request.ServerVariables["HTTP_X_FORWARDED_FOR"]) ?
Request.ServerVariables["REMOTE_ADDR"] :
Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment