开发者

Getting Client computer name ASP .NET

We are using :

System.开发者_如何学CNet.Dns.Resolve(Request.ServerVariables("remote_addr")).HostName

to get the client computer name in ASP .NET.

It works fine when run from visual studio, and even when run from IIS7, but IIS6 (or maybe some other factor) is only returning the client computer's domain name

Are there any settings or anything that would cause this function to return the domain name instead of the intended machine name?


Dns.Resolve is now obsolete and so thatmight be causing the issue. Try using Dns.GetHostEntry instead and see if that fixes the issue.


I am not sure what the cause of the issue is but this may help: http://msdn.microsoft.com/en-us/library/system.net.iphostentry.hostname.aspx

The HostName property contains the primary host name for a server. If the DNS entry for the server defines additional aliases, they will be available in the Aliases property.

It is possible that there are additional DNS entries and Aliases may contain what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜