c# - Converting IP address to host name via DNS.GetHostEntry -


i trying hostname passing in ip address. use following code.

system.net.dns.gethostentry("192.168.x.x").hostname 

for host above code returning correctly hostname, few other host throws exception 'no such host found'.

could 1 tell me why happening hosts?

i used above code in asp.net mvc application.

not ip's setup reverse dns entry. these ip's typically end consumers on lazy isp's don't provide ptr records clients. if there's no reverse entry, can bet there's no forward entry either. such, these hosts have no hostname @ all, hence exception. you'll need catch exception these hosts , use else such ip identifier.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -