亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

獲取客戶端IP

獲取客戶端IP

慕虎7371278 2018-07-26 09:10:25
網站放到外網如何獲取訪問的客戶端IP呢?請大家支支招吧,謝啦!
查看完整描述

2 回答

?
至尊寶的傳說

TA貢獻1789條經驗 獲得超10個贊

public static string GetClientIP()
        {            string clientIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];            if (string.IsNullOrEmpty(clientIP))
                clientIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];            if (string.IsNullOrEmpty(clientIP))
                clientIP = HttpContext.Current.Request.UserHostAddress;            if (string.IsNullOrEmpty(clientIP))
                clientIP = "0.0.0.0";            return clientIP;
        }


查看完整回答
反對 回復 2018-07-30
?
藍山帝景

TA貢獻1843條經驗 獲得超7個贊

Request.UserHostAddress

查看完整回答
反對 回復 2018-07-30
  • 2 回答
  • 0 關注
  • 650 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號