Friday, March 25, 2016

Start process as normal user from ClickOnce application

Leave a Comment

We have a ClickOnce application that starts an external process with

p = new Process(); p.StartInfo.WorkingDirectory = Path.GetDirectoryName(exe); p.StartInfo.FileName = Path.GetFileName(exe); p.StartInfo.Arguments = arguments; p.Start(); 

Usually, people ask whether it is possible to start the process as administration. But in my case it is the opposite:


I would like to make sure that this application is started as the user that is logged on. By default, that happens - for example when I test it.

But some users (Windows 8.1) report that the exe is started as administrator. For some weird reason, Windows automatically wants to start it as admin, even if it would not be necessary at all. If they right click on the exe and check the Properties, the box Run this program as an administrator is not checked!

When checking the exe file in the folder, it shows a UAC icon (example below):

enter image description here

Now I am wondering if it is programmatically possible to prevent that behavior and start the process in non-elevated state, maybe with a StartInfo property?

2 Answers

Answers 1

Maybe this will help you? launch C# exe without prompting UAC on Windows 7

Add this to your manifest:

requestedExecutionLevel level="asInvoker" uiAccess="false"

"It could be that your third party DLL has to run in elevated mode, so your best option is to run as administrator. Bypassing the UAC prompt without running as administrator is a long complicated process"

Answers 2

try to look in to these links

Run process under current user

and this for details got it from an answer in above link

https://social.msdn.microsoft.com/Forums/vstudio/en-US/0c0ca087-5e7b-4046-93cb-c7b3e48d0dfb/how-run-client-application-as-a-windows-service-in-c?forum=csharpgeneral

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment