In my web application i have registration form, when user register i want to get his ip address of his system, how can i get using asp.net. help me please.
HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
To get the IP address of the machine and not the proxy use the following code
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
HttpContext.Current.Request.UserHostAddress
尝试:
Request.ServerVariables["REMOTE_ADDR"].ToString()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.