如何在c#中获取计算机的唯一ID [英] how to get unique id of computer in c#

查看:1116
本文介绍了如何在c#中获取计算机的唯一ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道哪台计算机正在使用我的应用程序。

我在我的应用程序中有一个删除选项,我想知道如果有人从我的应用程序中删除了数据任何其他系统然后应该捕获它的IP地址或一些唯一的ID。我知道IP地址在全世界并不是唯一的,那么我应该捕获什么来知道哪台计算机使用了我的应用程序。

i want to know which computer is using my application.
that is i have a delete option in my application and i want to know that "if any one has deleted the data from my application from any other system then its ip address or some unique id should be captured".I know that ip address is not unique across the world then what i should capture to know which computer has used my application.

推荐答案

尝试使用系统的macaddress。



Try and use macaddress of the system.

public static PhysicalAddress GetMacAddress()
         {
         foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
             {
             // Only consider Ethernet network interfaces
             if (nic.NetworkInterfaceType == NetworkInterfaceType.Ethernet &&
                 nic.OperationalStatus == OperationalStatus.Up)
                 {
                 return nic.GetPhysicalAddress();
                 }
             }
         return null;
         }


这篇关于如何在c#中获取计算机的唯一ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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