Guest User

Untitled

a guest
Jun 20th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Request.UserHostAddress
  2.  
  3. string VisitorIPAddress = Request.UserHostAddress.ToString();
  4.  
  5. public static String GetIPAddress()
  6. {
  7. String ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
  8. if (string.IsNullOrEmpty(ip))
  9. ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
  10. else
  11. ip = ip.Split(',')[0];
  12.  
  13. return ip;
  14. }
  15.  
  16. Request.UserHostAddress
  17.  
  18. Request.UserHostAddress
Add Comment
Please, Sign In to add comment