RunAs a different user when debugging in Visual Studio

05/08/2016 18:23

Whether you need to open an app using two different credentials, you can do it following these steps:

 

By DOS - Command Line:

command.com /C runas /env /user:OtherUser DebugTarget.Exe

 

  • Hold SHIFT key and right-click to open a new instance of Visual Studio.
  • Click "run as different user" Run as different user
  • Enter credentials of the other user in the next pop-up window
  • Open the same solution you are working with

Now when you debug the solution it will be with the other user's permissions.

(Hint: if you are going to run multiple instances of Visual Studio, change the theme of it (like to "dark") so you can keep track of which one is which easily).

 

Further:

https://stackoverflow.com/questions/1287099/runas-a-different-user-when-debugging-in-visual-studio