Solved

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

Posted on 2008-10-12
5
3,345 Views
Last Modified: 2008-10-16
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?
0
Comment
Question by:intellect22
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22698300
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/
0
 

Author Comment

by:intellect22
ID: 22699225
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....)
0
 

Author Comment

by:intellect22
ID: 22699254
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
0
 

Author Comment

by:intellect22
ID: 22699259
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....
0
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 500 total points
ID: 22713488
While creating installer for  your application you can specify the permissions to be given for the folders. Specify full access for the folders you want either for the Logged in user or for everyone account. I think that should fix your issue. If the folder is some special folder like system32 or Windows then it is better to notify user to run as admin.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now