|
-
Jan 15th, 2009, 10:28 AM
#1
File Permissions in VB2008
Hi,
I'm trying to put together a simple "file search" app that lets the user specify where to look, what type of files to look for, what the minimum file size is, etc. (I know...sounds kinda like capabilities that already exist in Windows!). I'm running into "access" issues, even with directories that I wouldn't think I should have any trouble accessing.
I'm doing something like this:
Dim f As New FileIOPermission(PermissionState.Unrestricted)
f.AllLocalFiles = FileIOPermissionAccess.Read
Try
f.Demand()
Catch s As SecurityException
Console.WriteLine(s.Message)
End Try
All I want to do is get the file attributes (size, location, name, date modified, etc.). I don't want/need write access.
Any suggestions? Thanks!
Bryce
-
Jan 15th, 2009, 12:24 PM
#2
Re: File Permissions in VB2008
Are you running this on Vista? If you're running it from Visual Studio, you'll have to close VS and then select 'run as administrator'. This will solve quite a few problems. But not all.
There are 4 integrity levels in vista: low, medium, high and system. As an administrator, you operate by default at the low level, but can choose to elevate yourself and processes all the way up to 'high' should you require it. Unfortunately, there is still one level higher, which is 'system'.
The problem you are going to have is that this 'system' level (who is also a 'user' in vista) owns a bunch of files and folders on the OS. And even when you elevate your security level as an administrator, you still fall short of this mark.
You may want to take a look at this article for developing in vista. It does mention the ability to create a system access token, but I didn't read fully.
Last edited by MaximilianMayrhofer; Jan 15th, 2009 at 12:37 PM.
-
Jan 15th, 2009, 12:43 PM
#3
Re: File Permissions in VB2008
Max,
I've had the issue both in XP and in Vista.
I'll check out the link you provided, though.
Thanks!
Bryce
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
|