Getting rid of “there was a problem sending the command to the program” without compromising security

June 3, 2010

Description of the problem:

You have a config file that you want to edit in Visual Studio. You don’t want to open the entire project, to just make a quick change, and you right click on the file, and select Open with Visual Studio. At that point you get this error message (noted above) and visual studio opens, but there is no sign of the file.

 

How thinking you are clever, almost always turn out to prove the opposite:

If you have the user account control fairly strict, then each time you open a web project, Visual Studio will tell you, that you should have launch Visual Studio as an administrator. So this is where I made a huge mistake. Thinking I was very smart, I went to the devenv.exe and set the administrator option on the files compatibility tab.

I figured, that way I will always run the development environment under the right credentials, right?

 

I was VERY wrong. The following is a screen shot of the Security tab, in process explorer of the Visual Studio launched with the compatibility set to Run as Administrator

So let’s compare that to the same screen shot, but of the Explorer process

 

So here is the interesting bit.

The explorer process launches visual studio with the security of the process set to DENY administrators any access. Then we try to launch visual studio in that context, but we say to the operating system, that whenever the devenv.exe process is launched it must always run as administrator. Keeping in mind that the DENY permission, always overrides all other permissions, no wonder there is problems for visual studio trying to open the file.

 

Fixing it without compromising the security of my system:

Undo where you fiddled with the system where you should not have fiddled in the first place.

Create a shortcut, and set the shortcuts properties to run as administrator. So know when you know you need to touch IIS and make changes, then you launch visual studio with your admin shortcut. All other times when you want to modify config files, you run under lower privileges, and you stay safe and secure.

So know I have been made humble again, and hopefully will respect the security of the system a bit better.

 


Follow

Get every new post delivered to your Inbox.