Click here to Skip to main content
15,891,880 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set my windows exe application with permission...
I tried as follows:
C#
ProcessStartInfo processInfo = new ProcessStartInfo();
                   processInfo.Verb = "runas";
                   processInfo.FileName = Application.ExecutablePath;

                   Process.Start(processInfo);

                   // ClsAdminRights.RunElevated(Application.ExecutablePath);
                   ClsAdminRights.IsAdminPrevilegeSetted = true;

Also set a new mainfest file with administartive rights....
Still access denied issue shown...
Posted
Updated 19-Apr-13 4:54am
v2
Comments
Thomas Barbare 19-Apr-13 6:33am    
Here a link about process with administration rights :

C# process as administrator

Really depends of your OS version.
Hope that will help you !
Sergey Alexandrovich Kryukov 19-Apr-13 12:23pm    
Right. I basically answered, please see.
—SA

1 solution

It depends on OS. For example, on Windows 7, it is not enough to log on as administrator. You also need to run application with elevated privileges.

Please see:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/[^],
http://www.sevenforums.com/tutorials/11841-run-administrator.html[^].

I think you understand that you cannot run code to elevate privileges without use confirmation, otherwise it would defeat the purpose of UAC (http://en.wikipedia.org/wiki/UAC[^]). But you can request the privilege from the very beginning whenever the user runs your application. You really should do it, otherwise you would have an exception thrown. Here is how:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].

Good luck,
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900