Thursday, 13 January 2011

Who are you? Who are you? (2)

One of my colleagues solved this and it had nothing to do with using Ping as I suggested in the original post on this subject. Instead we're using something called the 'winmgmts' object, which is actually linked to to SVCHOST process that runs on the Windows OS.

We sent the following command to this object:

"SELECT * From Win32_PingStatus WHERE Address='" _
& HttpContext.Current.Request.UserHostAddress & "' AND ResolveAddressNames=TRUE")

passing in the IP address of the computer connecting to the application on the server and received a collection of results back which we iterated through to find the hostname.

I would never have thought of this in a million years, kudos to my colleague for discovering it.

No comments: