Link to home
Start Free TrialLog in
Avatar of intellect22
intellect22

asked on

How to make a vb.net 2008 application run As Administrator

Hey guys,
This is very frustrating! I have an application that needs to have permission to create folders and files on the users PC. So with Vista I need to have admin rights in order for the program to work properly. All I am able to figure out is how to get the setup.exe file to run as admin. What I need is the actual installed application to run as admin so it can create the folders and files as needed. After I install the application, if I go to the shortcut it creates or even the application itself and right-click, it does not give me the option to run ad administrator (its not in the advanced options under properties either). When creating the application I went to the publish properties and set it to as for admin rights, but it only seems to do this when installing the app, not when running the installed app. Does anyone know how I can set this up so that it prompts for admin rights when the user runs the installed app?
Avatar of Toms Edison
Toms Edison
Flag of India image

It is the user who decides whether to run an application with admin rights or not. If the installer decides to run it with admin rights then it is against security.
Once your application runs you can probably check if it has got admin privilege and display a message to user saying that he should run the application as admin.

check out how to run as admin
http://www.howtogeek.com/howto/windows-vista/always-start-an-application-in-administrator-mode-on-windows-vista/
http://www.wikihow.com/Always-Run-an-Application-As-Administrator-in-Windows-Vista
http://www.vistaclues.com/always-run-an-application-as-an-administrator/http://www.vistaclues.com/always-run-an-application-as-an-administrator/
Avatar of intellect22
intellect22

ASKER

hmm well I already knew how to do those things (stated that in my question) after doing some digging around it looks like my app is using ClickOnce and ClickOnce does not support elevated admin rights. Does anyone know how to disable ClickOnce (im not even sure what exactly clickonce is....)
Ok here is the error I am getting. I have tried turing on the OneClick security setting but that doesnt seem to work...

Error      3      ClickOnce does not support the request execution level 'requireAdministrator'.      Classified Ads Creator
Maybe I am missing something here....I don't care how I do it all I want to do is enable my app to be able to create directories and files....
ASKER CERTIFIED SOLUTION
Avatar of Toms Edison
Toms Edison
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial