if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) { ClientIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; //取得真實用戶端的IP } else { ClientIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; //取得用戶端的IP(有可能為代理伺服器) }
沒有留言:
張貼留言