C 通過url獲得ip位址

2021-04-14 22:57:34 字數 822 閱讀 8341

using system;

using system.data;

using system.configuration;

using system.collections;

using system.web;

using system.web.security;

using system.web.ui;

using system.web.ui.webcontrols;

using system.web.ui.webcontrols.webparts;

using system.web.ui.htmlcontrols;

using system.diagnostics;

public partial class admin_bbsyear : system.web.ui.page

private static string cmdping(string strip)

else if (strrst.indexof("destination host unreachable.") != -1)

pingrst = "無法到達目的主機";

else if (strrst.indexof("request timed out.") != -1)

pingrst = "超時";

else if (strrst.indexof("unknown host") != -1)

pingrst = "無法解析主機";

else

pingrst = strrst;

p.close();

return pingrst;}}

獲得IP位址

在asp 中使用 request.servervariables remote addr 來取得客戶端ip 位址但如果客戶端是使用 伺服器來訪問那取到就是 伺服器ip 位址而不是真正客戶端 ip 位址 要想透過 伺服器取得客戶端真實ip 位址就要使用 request.servervariables ...

獲得ip和mac位址

using system.runtime.interopservices dllimport iphlpapi.dll private static extern intsendarp int32 dest,int32 host,refint64 mac,refint32 length dllimp...

java 獲得真實 ip 位址

在jsp裡,獲取客戶端的ip位址的方法是 request.getremoteaddr 這種方法在大部分情況下都是有效的。但是在通過了apache,squid等反向 軟體就不能獲取到客戶端的真實ip位址了。如果使用了反向 軟體,將 的url反向 為 的url時,用request.getremotead...