Solved

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

Posted on 2008-10-12
5
3,357 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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