I was trying to use the sentence
Environment.SetEnvironmentVariable("CLIENTIP", <value>)
but the variable is not created. I used both an string variable and a constant to set the value.
So, how can I do this to work?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Can you explain what you mean by didn’t work? That code will certainly set the environment variable CLIENTIP for the current process.
If you wanted to set it more broadly you’re going to have to use a different overload of the
SetEnvironmentVariablemethod.The
EnvironmentVariableTargetparameter lets you target the process, machine or current user.Note: These changes likely won’t show up in existing processes as not all types of processes respond to this change immediately (cmd.exe is one that comes to mind). But it will show up on future processes.