|
-
Feb 7th, 2009, 11:07 PM
#1
Thread Starter
Junior Member
Help with Vista and permission and VB.Net app
Hi,
Here is the situation. I've written a VB.Net app that has three components; an EXE and DLL and a Outlook Plug-in. The EXE and the Outlook Plug-in both call the DLL to check if a local SQL Server CE Database exists in the CommonAppData folder.
Under WinXP there isn't a problem and everything works great but under Visa the EXE works fine but the Outlook Plug-in returns an Access Denied to the ProgramData\...\.sdf file.
Under Vista, if I enable the directory in question to have write permission to all users everything is ok.
As a solution I would like to have the MSI file that I create with a Setup project change the permission on the folder to have read/write permission but I'd like to understand why this is happening. Also I'm not quite sure how to have the MSI change the folder permissions
Any ideas on either?
Thanks,
Kevin
-
Feb 9th, 2009, 06:38 AM
#2
Member
Re: Help with Vista and permission and VB.Net app
Hi,
Have you tried Right clicking the exe and 'run as administrator' ?
Some places - eg. the registry, C:\Program Files, System32, etc - require administrative privileges to before being able to write to them.
If this is indeed the problem you are having my best solution is create your own Applcation Settings (or whatever purpose this write permission is needed for) in the 'my documents' folder and write to that instead.
Hope this helps
-
Feb 9th, 2009, 10:08 AM
#3
Addicted Member
Re: Help with Vista and permission and VB.Net app
Open Your Project then do this:
My Project > View UAC Settings > Change uiAccess=false to uiAccess=true
Then he can only run the Program as a Administrator
-
Feb 9th, 2009, 11:06 AM
#4
Re: Help with Vista and permission and VB.Net app
 Originally Posted by KPMoore
Under WinXP there isn't a problem and everything works great but under Visa the EXE works fine but the Outlook Plug-in returns an Access Denied to the ProgramData\...\.sdf file.
This makes sense; you should never write user data to a file in Program Files. While it works under XP in normal conditions you also shouldn't do it there. It's bad practice and limits your application's usage to one user.
Instead, place any type of file that needs to be written to in the user's folder.
 Originally Posted by KPMoore
As a solution I would like to have the MSI file that I create with a Setup project change the permission on the folder to have read/write permission but I'd like to understand why this is happening. Also I'm not quite sure how to have the MSI change the folder permissions
No NO NO! You're circumventing Vista's security to make your application work in a way it really shouldn't to begin with. Don't change these permissions.
Put your data files in the user folder where it belongs.
 Originally Posted by alexjanjic
Open Your Project then do this:
My Project > View UAC Settings > Change uiAccess=false to uiAccess=true
Then he can only run the Program as a Administrator 
The problem isn't him running the application; it's Outlook trying to use his plugin.
-
Feb 9th, 2009, 11:11 AM
#5
Re: Help with Vista and permission and VB.Net app
 Originally Posted by alexjanjic
Open Your Project then do this:
My Project > View UAC Settings > Change uiAccess=false to uiAccess=true
Then he can only run the Program as a Administrator 
Doesnt that kind of defeat the whole purpose of UAC?
EDIT: looks like Kasracer beat me to it
-
Feb 9th, 2009, 11:13 AM
#6
Addicted Member
Re: Help with Vista and permission and VB.Net app
 Originally Posted by chris128
Doesnt that kind of defeat the whole purpose of UAC?
EDIT: looks like Kasracer beat me to it 
No because you still have to click Accept to run the Program 
But that tells the System that that Program can only be Run as an Administrator.
-
Feb 9th, 2009, 11:20 AM
#7
Re: Help with Vista and permission and VB.Net app
Exactly, and the whole point of UAC is to keep users running things in 'Standard User' mode for the most part but then being able to elevate to Administrator when absolutely necessary. It is certainly not absolutely necessary to run an app as an Admin just for it to be able to save some data to your hard drive. As Kasracer pointed out, you should be saving data to somewhere that the user CAN access, not saving it to a restricted area and then forcing them to run the app as an admin...
-
Feb 9th, 2009, 11:30 AM
#8
Re: Help with Vista and permission and VB.Net app
 Originally Posted by alexjanjic
No because you still have to click Accept to run the Program
But that tells the System that that Program can only be Run as an Administrator.
You're still ignoring the fact that the OP is having this issue with the Outlook plug-in in which case those settings wouldn't change anything or even prompt him to elevate. Regardless it's still poor practice and limits the user experience to only one user (unless you want to share data with all users on your machine).
Though, if both applications are using the same DLL I'm not sure why the EXE works unless the OP is elevating.
-
Mar 21st, 2010, 04:56 AM
#9
Junior Member
Re: Help with Vista and permission and VB.Net app
I have a similar problem, and this time it cannot be solved by "putting it in the right folder".
I'm trying to have automatic updates for my application, throughout my network.
It works perfectly on my machine, because I've disabled the UAC.
But on the others with UAC on, it crashes when updating the files because it doesn't have the permission to do so.
I could always add Try etc..
But it still won't update so there's no point yet, lol.
Files are located in C:\Program Files\MyProgram
I have to be able to change the permissions of my program folder...
Maybe even somehow in Inno install, when it creates it.

-
Mar 21st, 2010, 07:40 AM
#10
Member
Re: Help with Vista and permission and VB.Net app
See, what happens these days (to my knowledge),
is that somewhere online you host a Version Number
and everytime your application starts up it check to see if there is an internet connection, if so it will find the version number...
now if the version number is the same then nothing needs to be done,
If the latest version application (via version number) is higher than your application's, it needs to launch an updater or start retrieving those updatable files. At this point you know that you will be needing elevation (thus prompt for administrative rights).
If you think about this briefly, even something inbuilt as Windows Update require you to elevate before installing,
Windows Update is your Applications Updater, in metaphor....
You see?
What I'm saying is, you must update from client side. Also ensure that your not overwriting files that your actually using during your 'update process'.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|