本文介绍了获取计算机名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了获取计算机名称,我写了如下内容:
To get the computer name I wrote something like below:
Dim client As System.Net.IPHostEntry
client = System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST"))
label1.text=client.hostname
此代码在服务器机器上有效,但在客户端机器上不起作用.
This code works on the server machine but on the client machine its not working.
有没有其他方法可以找到计算机名称.
Is there any another way to find the computer name.
推荐答案
你需要看一下客户端的请求,例如:
You need to look at the request from the client, for example:
label1.Text = HttpContext.Current.Request.UserHostName;
查看更多关于 HttpRequest.UserHostName 属性
这篇关于获取计算机名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!