如何配置配置文件以允许获取网络信息 [英] How to configure configuration file to allow get network information

查看:100
本文介绍了如何配置配置文件以允许获取网络信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码从服务器获取访问者的实际地址

i'm getting visitor's physical address from server using following code

public string GetMACAddress()
        {
            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
            String sMacAddress = string.Empty;
            foreach (NetworkInterface adapter in nics)
            {
                if (sMacAddress == String.Empty)// only return MAC Address from first card  
                {
                    IPInterfaceProperties properties = adapter.GetIPProperties();
                    sMacAddress = adapter.GetPhysicalAddress().ToString();
                }
            } return sMacAddress;
        }



遗憾的是托管系统管理员阻止了这一点。

需要做什么才能通过web配置文件。


unfortunately this was prevented by hosting system administrator.
what need to be done to make allow it through web configuration file.

推荐答案

嗯。你确实意识到,即使是彼得和理查德所说的,你也无法获得你网站访问者的MAC地址,并且该代码只返回本地网段上计算机的MAC地址,即使是托管系统管理员 允许它。



MAC地址不会通过将套件连接到互联网的路由器(如果他们这样做就不会工作,因为他们只需要在LAN网段中是唯一的,并且在全球范围内并不是唯一的。 欺骗MAC地址也非常容易。



除此之外,MAC地址不会为您提供有关物理位置的信息:它是一个识别网络组件的小代码,直到可以为其分配IP地址。赢得了IP地址;为您提供有关地理位置的可靠信息。



使用cookie来识别授权用户。没有cookie,没有条目。
Um. You do realize that even with what Peter and Richard have said, you can't get the MAC address of a visitor to your website, and that code will only return MAC addresses for computers on the local segment, even if the "hosting system administrator" would permit it.

MAC addresses do not go past the router which connects the kit to the internet (and wouldn't work if they did since they only have to be unique within a LAN segment and are not unique globally). It's also incredibly easy to "spoof" MAC addresses.

And to add to that, the MAC address doesn't give you an information about a physical location: it's a small code which identifies a network component until it can be assigned an IP address. And the IP address won;t give you any reliable info about geographical location either.

Use cookies to identify authorised users instead. No cookie, no entry.


这篇关于如何配置配置文件以允许获取网络信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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