Retrieving the PC Name of a Client? (Windows Auth)

旧街凉风 提交于 2020-01-04 01:52:44

问题


I have an ASP.net Application that runs on the internal network (well, actually it's running on Sharepoint 2007).

I just wonder:

Can I somehow retrieve the name of the PC the Client is using? I would have access to Active Directory if that helps. The thing is, people use multiple PCs. So, I cannot use any manual/static mapping.

If possible, I do not want to use any client-side (read: JavaScript) code, but if it cannot be done server-side, JavaScript would be OK as well. ActiveX is absolutely out of question.


回答1:


System.Web.HttpRequest.UserHostname as suggested in this answer just returns the IP :-(

But I just found this:

System.Net.Dns.GetHostEntry(Page.Request.UserHostAddress).HostName

That only works if there is actually a DNS Server to resolve the name, which is the case for my network.




回答2:


Does System.Web.HttpRequest.UserHostname provide what you're looking for?



来源:https://stackoverflow.com/questions/17664/retrieving-the-pc-name-of-a-client-windows-auth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!