Read client environment variable C #

0

I have a web application made with C #, which is installed on a server to which different terminals access. To identify each terminal I have a system environment variable created in each terminal to which I have to access from the server. I tried with Environment.GetEnvironmentVariable but it always returns the server variables.

    
asked by Gonzalo Cayafa 19.10.2018 в 04:00
source

1 answer

0

You are in a web development the code that runs on the server side only has access to the PC where you are hosted

In the client is the browser that interprets html and javascript, if you need the environment variable of the client you should send it in the request that you make to the server.

Reading environment variables with Javascript

Javascript environment variables

There is always the alternative to try using

var ax = new ActiveXObject("wscript.shell");

assign the value in some hidden and send it in the post

But truthfully I would not recommend that you use ActiveXObject this is no longer supported by many browsers

Remember that accessing information on the user's PC has security problems, that's why this thing you want to do would not be allowed

    
answered by 19.10.2018 в 12:55