Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run a program from visual studio without elevated permissions?

Okay, so originally I was going to ask about dragging and dropping in Windows 7. I found the answer I was looking for here: C# Drag drop does not work on windows 7. Basically it says that since I'm running Visual Studio (and subsequently, my program) with elevated permissions, some sort of isolation layer prevents me from dragging and dropping files from explorer into my program.

The reason I run visual studio with elevated permissions is because admin privileges are needed to run a site locally on IIS and the web app is in my solution. Is there a way I can tell visual studio to run and debug my other apps as a normal user?

like image 557
Jason Thompson Avatar asked May 19 '26 06:05

Jason Thompson


2 Answers

Why don't you just create another short-cut on the desktop that starts devenv.exe without elevation?

like image 156
Hans Passant Avatar answered May 21 '26 20:05

Hans Passant


MSDN states:

Launching an Un-Elevated Application from an Elevated Process

A frequently asked question is how to launch an un-elevated application from an elevated process, or more fundamentally, how to I launch a process using my un-elevated token once I’m running elevated. Since there is no direct way to do this, the situation can usually be avoided by launching the original application as standard user and only elevating those portions of the application that require administrative rights. This way there is always a non-elevated process that can be used to launch additional applications as the currently logged on desktop user. Sometimes, however, an elevated process needs to get another application running un-elevated. This can be accomplished by using the task scheduler within Windows Vista®. The elevated process can register a task to run as the currently logged on desktop user.

You could use that and implement a simple launcher app (possibly a VS macro) that you start instead of your application. The launcher app would:

  • Create a scheduled task that would run immediately or that is triggered by an event
  • Start the debuggee
  • Connect the VS debugger to the started process
like image 43
Dirk Vollmar Avatar answered May 21 '26 18:05

Dirk Vollmar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!