public static string GetIP()
{
string ip;
if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
{
ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
return ip;
}spa
轉載自:https://wenda.so.com/q/1367574009062436ip