Capture Machine Identification with C#

Asked

Viewed 1,380 times

4

Good morning, I have several computers with the same output IP, how can I get any information that leads me to know which computer a request came from? I use C# Asp . Net MVC

  • What is an output IP? Are you saying that multiple machines are connected to a central network server that has an IP? Is your site accessed by this server on behalf of the other machines? Or do you have access to the machines independent of the site? It matters if it is ASP.Net?

  • what you want to know from the computer that came the request, only the name can be ?

  • The system works in the Intranet mode?

  • Exactly @bigown, I have a central network server with an IP and the site is accessed by a machine connected to this server, so the external IP of the machines is always that of the server, I can get some information from the machine that is actually accessing ?

  • @Ciganomorrisonmendez No, is a site even published.

  • I would have thought that, but it’s not gonna do it for you. Nor would it be very reliable either: http://www.codeproject.com/Questions/402043/Finding-ip-address-behind-proxy I’m pretty sure I can’t. I’m just not sure because there might be something that you have control over that helps with it. But if it’s something within the standards, it’s not.

  • You need know which machine is ordering, or only differentiating each machine, without knowing which one is?

Show 2 more comments

2 answers

1

The solution is to identify only the machine. The problem is that the best way to do this would be to get some hardware information, such as the MAC address of the network adapter or even some information about the motherboard.

For this, you need to install a component in the browser of the machine that is performing the access. Only in this way it is possible to obtain more information and elaborate a cookie that is able to provide information about the hardware that is doing the access.

1

It depends a little on how much security you need in this identification.


Differentiating machines without guaranteeing identity

You can use cookies. When there is a request without the cookie, you generate a unique key and register it in the cookie. If a machine loses the cookie, a new one will be generated. You will not know which machine it is, but you will not 'confuse' the machines.


Differentiate machines by identifying them (but not with very good safety)

Take a look at Httprequestbase.Browser.

Maybe there’s some information you can use to distinguish the machines. Browser ID can be one of them.

Another option, only even more vulnerable (any well advanced user could circumvent) would send the local IP by ajax in your layout. Obviously, in this case, the IP would come after the request (initial at least) and you would have to deal with it on the server side - probably identifying the machine and registering it in the section.

<script type='text/javascript'>
    var yip2=java.net.InetAddress.getLocalHost();   
    var yip=yip2.getHostAddress();

</script>

Source: Getting local IP address in javascript


Differentiate the machines, identifying them safely

A priori the direct way would be to use a component installed in the machine, as the Gypsy spoke.

  • The second solution you propose is not in c# but in java, note the link. referring to the cookie, I think the best option, really.

  • Exactly, it would run on the page in the browser, so in javascript. You would insert the code into the html rendered by the view, plus a mechanism for the page to post the IP returned through javascript.

  • Pointing out, the code in C#, whether in the view, or in the controller, only runs on the server. Javascript runs on the browser, therefore on the client machine.

  • i meant, that your code is wrong, that the code you posted above is JAVA, not javascript...

  • The previous code works on a page, like javascript. It didn’t have script tags, but it was correct.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.