跟踪mac地址和ip地址 [英] Tracing of mac address and ip address

查看:122
本文介绍了跟踪mac地址和ip地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai朋友我已经在公共服务器上部署了一个项目现在我想跟踪那些正在使用该项目的人的mac地址和ip地址(该项目是一个网站)所以当他们打开那个网站我需要跟踪mac地址和该特定电脑的IP地址。请帮助我。谢谢。

Hai friends i have deployed a project in public server now i want to trace mac address and ip address of those who are using that project(that project is a website) so when they open that website i need to trace mac address and ip address of that particular pc. Kindly help me. Thank you.

推荐答案

在开始抛出跟踪MAC地址之前,了解TCP / IP和路由的工作原理。您将无法获得客户端的MAC,除非它与您的服务器位于同一网段内。您将获得离服务器最近的路由器的近端接口的MAC。



无法获取Web客户端的MAC地址路由器的另一面。
Learn how TCP/IP and Routing works before you start throwing around "track MAC address". You will NOT get the MAC of the client unless it's inside the same network segment as your server. You'll get the MAC of the near-side interface of the router nearest the server.

There is no way to get the MAC address of a web client on the other side of a router.


在您的站点中获取客户端IP

Web应用程序能够检测到IP的需求非常普遍客户的地址。 I.P.地址可用于统计或身份验证。

Get Client IP in your site
It’s pretty common the need for a web application to be able to detect the I.P. address of a client. The I.P. address could be used either for statistic or authentication purposes.
<pre lang="cs">public object ClientIpAddress(HttpRequest myRequest)
{
    string myIP = "";

    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_CLIENT_IP");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_X_FORWARDED_FOR");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_X_FORWARDED");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_X_CLUSTER_CLIENT_IP");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_FORWARDED_FOR");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("HTTP_FORWARDED");
    if ((string.IsNullOrEmpty(myIP)))
        myIP = myRequest.ServerVariables("REMOTE_ADDR");

    return myIP;
}


public string Host2Ip(string HostName)
{
    string functionReturnValue = null;
    try {
        System.Net.IPHostEntry myIPs = null;
        myIPs = System.Net.Dns.GetHostEntry(HostName);
        functionReturnValue = myIPs.AddressList[0].ToString();
    } catch (Exception ex) {
        //Handle the error
    }
    return functionReturnValue;
}</pre>


查看跟踪客户端IP的良好解决方案





地理定位的IP地址
See a good solution for track Client IP


IP Address to Geolocation


这篇关于跟踪mac地址和ip地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆