Michael Sterling
asked on
How do I programmatically pull / access the computer name on any given machine (laptop / desktop) etc.?
How do I programmatically pull / access the computer name on any given machine (laptop / desktop) etc.?
Are you referring to client machines that access your website? If so, is this an Intranet or Internet site?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To expand on kaufmed's comment, if you are trying to get the computer name of client machines that access your website, it will only work for machines on your local network, as machine names are concept of local networks. If any of them connect via the internet to your server they won't give a machine name, just IP address.
To get client computer names of machines on your local network, you will need to use reverse DNS:
In C#:
string clientMachineName;
clientMachineName = (Dns.GetHostEntry(Request. ServerVari ables["rem ote_addr"] ).HostName );
Response.Write(clientMachi neName);
In classic ASP you can use something like this: http://www.asp101.com/articles/jason/reversedns/default.asp
To get client computer names of machines on your local network, you will need to use reverse DNS:
In C#:
string clientMachineName;
clientMachineName = (Dns.GetHostEntry(Request.
Response.Write(clientMachi
In classic ASP you can use something like this: http://www.asp101.com/articles/jason/reversedns/default.asp
ASKER
@kaufmed & @matthewstevenkelly: well i guess i'll need to get the IP address then. what i'm attempting to do is limit where (which machines) users can do certain things within my web site that will be eventually hosted on goDaddy. I only want certain functionality available if the user is on machine(s) x, y, z...is there a better way of doin this? how would this "plan" be affected if the user were to use a laptop?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Using the IP address is not a good method for authentication because it can be spoofed: http://en.wikipedia.org/wiki/IP_address_spoofing
Additionally, when multiple users are behind the same router, they will all appear to your website with the same IP address.
You can see this for yourself, if you have a home router, and more than one computer connected to it, go to http://www.whatismyip.com/ and they will both show the same IP address. And as mentioned previously, most users have a dynamic IP address, so it changes every time the router is rebooted.
You can get a users IP address in C# by using: Request.ServerVariables["r emote_addr "]
But it should only be used as an FYI, not authentication.
If you don't need a lot of security, you could just use cookies to track the machine. Basically when the user goes to a website a cookie will be put on their computer that your website could then check for to know if they have been there before. But this should only be used if you are trying to remember if the user has been there before, not to get any kind of account information as it is highly insecure.
Otherwise, username and password is how you will need to go.
Additionally, when multiple users are behind the same router, they will all appear to your website with the same IP address.
You can see this for yourself, if you have a home router, and more than one computer connected to it, go to http://www.whatismyip.com/ and they will both show the same IP address. And as mentioned previously, most users have a dynamic IP address, so it changes every time the router is rebooted.
You can get a users IP address in C# by using: Request.ServerVariables["r
But it should only be used as an FYI, not authentication.
If you don't need a lot of security, you could just use cookies to track the machine. Basically when the user goes to a website a cookie will be put on their computer that your website could then check for to know if they have been there before. But this should only be used if you are trying to remember if the user has been there before, not to get any kind of account information as it is highly insecure.
Otherwise, username and password is how you will need to go.
ASKER
thanks for your contributions