Solved

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 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