Solved

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

Posted on 2008-10-12
5
3,340 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

11 Experts available now in Live!

Get 1:1 Help Now