string user_IP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"];
//頁面的url
string nowUrl = HttpContext.Current.Request.Url.ToString();
//獲得客戶端的IP
string result = String.Empty;
if (string.IsNullOrEmpty(result))
{
result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
if (string.IsNullOrEmpty(result))
{
result = HttpContext.Current.Request.UserHostAddress;
}
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.UserHostAddress;
}
服務器發送string user_IP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"];