.net»ñÈ¡IPµØÖ·µÄ¼¸ÖÖ·½·¨
·þÎñ¶Ë£º
//·½·¨Ò»
HttpContext.Current.Request.UserHostAddress;
//·½·¨¶þ
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
//·½·¨Èý
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
//·½·¨ËÄ£¨ÎÞÊÓ´úÀí£©
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
HttpContext.Current.Request.UserHostAddress;
//·½·¨¶þ
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
//·½·¨Èý
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
//·½·¨ËÄ£¨ÎÞÊÓ´úÀí£©
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
¿Í»§¶Ë£º
//·½·¨Îå
var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);
//·½·¨Áù£¨ÎÞÊÓ´úÀí£©
function GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress;
obj = null;
}
catch(e)
{
//
}
return rslt;
}
var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);
//·½·¨Áù£¨ÎÞÊÓ´úÀí£©
function GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress;
obj = null;
}
catch(e)
{
//
}
return rslt;
}
À´×ÔÓ¡¶ÈµÄMCT Maulik PatelÌṩÁËÒ»ÖÖ·þÎñ¶ËµÄ½â¾ö·½°¸£¬ºÜºÃ£º
if(Context.Request.ServerVariables["HTTP_VIA"]!=null) // using proxy
{
ip=Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); // Return real client IP.
}
else// not using proxy or can't get the Client IP
{
ip=Context.Request.ServerVariables["REMOTE_ADDR"].ToString(); //While it can't get the Client IP, it will return proxy IP.
}
{
ip=Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); // Return real client IP.
}
else// not using proxy or can't get the Client IP
{
ip=Context.Request.ServerVariables["REMOTE_ADDR"].ToString(); //While it can't get the Client IP, it will return proxy IP.
}
±¸×¢£º
1. ÓÐЩ´úÀíÊDz»»á·¢¸øÎÒÃÇÕæʵIPµØÖ·µÄ
2. ÓÐЩ¿Í»§¶Ë»áÒòΪ¡°header_access deny¡±µÄ°²È«ÉèÖöø²»·¢¸øÎÒÃÇIP
ÍƼöÐÅÏ¢
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- Asp.net MVCÔ´Âë·ÖÎö--Model Validation(Se....
- .Net À¬»ø»ØÊÕ»úÖÆÔÀíºÍËã·¨£¨Ò»£©
- .netʵÌåнâ
- ·ÖÎöASP.NET¶ÁÈ¡XMLÎļþ4ÖÖ·½·¨
- »ñÈ¡ÍøÕ¾ËõÂÔͼ´úÂë
- Asp.net ¸ù¾ÝIPµØÖ·»ñÈ¡¿çÍø¶ÎmacµØÖ·º¯Êý¡¾ËѲء¿
- ¹ýÂËÃô¸Ð¹Ø¼ü×Ö¡£
- Éú³ÉÖ¸¶¨Î»ÊýµÄËæ»ú×Ö·û´®
- ¿Í»§¶Ë»ñÈ¡MACµØÖ·£¬µ½·þÎñÆ÷ÑéÖ¤
- ²½²½ÎªÓª .NETÈý²ã¼Ü¹¹½âÎö ¶þ¡¢Êý¾Ý¿âÉè¼Æ
ÆÀÂÛ