|
-
Jan 6th, 2009, 08:30 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] deleting
right now, im using Windows Vista..
in Windows XP, deleting a file is working with this code
Code:
System.IO.File.Delete("C:\testdelete.jpg")
But in Windows Vista, i encounter this message: Access to the path 'C:\testdelete.jpg' is denied.
why its happening? what is the solution for this?
-
Jan 6th, 2009, 08:38 PM
#2
Re: [2005] deleting
Is UAC enabled? If so, you need elevated privlidges to delete files from many folders.
-
Jan 6th, 2009, 08:39 PM
#3
Thread Starter
Fanatic Member
Re: [2005] deleting
how would i know if UAC is enabled?
-
Jan 6th, 2009, 08:47 PM
#4
Re: [2005] deleting
UAC are those prompts that ask for your permission to continue operations.
-
Jan 6th, 2009, 08:53 PM
#5
Re: [2005] deleting
The C:\ root drive is restricted in Vista, you'll have to put your files elsewhere
-
Jan 6th, 2009, 08:54 PM
#6
Thread Starter
Fanatic Member
Re: [2005] deleting
oh in vista? it does not prompt in Vista when im using vb.net?
pls instruct me what to do enable it pls?
-
Jan 6th, 2009, 09:06 PM
#7
Addicted Member
Re: [2005] deleting
My Project > Application > View UAC Settings
Change:
uiAccess="false"
to
uiAccess="true"
Then you always run your Software as Administrator
-
Jan 6th, 2009, 09:07 PM
#8
Re: [2005] deleting
Is the application for your exclusive use, or do you intend others to use it?
-
Jan 6th, 2009, 09:22 PM
#9
Thread Starter
Fanatic Member
Re: [2005] deleting
for my personal but, it will be for future use of others too..
-
Jan 6th, 2009, 09:27 PM
#10
Re: [2005] deleting
 Originally Posted by arshesander
..... it will be for future use of others too..
In that case, it is possible that the users may have Vista, therefore you need to take that into account. As mentioned on Vista OS's you should stear clear of the HDD root ('C:') for installs. There are a few posts on this forum relating to Vista install options.
-
Jan 6th, 2009, 09:38 PM
#11
Thread Starter
Fanatic Member
Re: [2005] deleting
I go to
My Project > Application >
but no View UAC Settings is vs.net 2005?
-
Jan 6th, 2009, 09:44 PM
#12
Thread Starter
Fanatic Member
-
Jan 6th, 2009, 09:49 PM
#13
Re: [RESOLVED] [2005] deleting
Not sure about VB.2005, however in 2008, Right click the project in the Solutions Explorer, and select Properties. From Application tab in that window you can select 'View UAC Settings'.
As mentioned in the post I deleted, you probably are better off installing to the appropriate location for any OS situation.
-
Jan 6th, 2009, 10:27 PM
#14
Re: [RESOLVED] [2005] deleting
You're writing to a directory that requires administrator access. This is unadvised unless you're developing a system utility that needs to access restricted folders. Instead, you should be writing to only user directories. There are temporary folders just for temporary data (which is what you appear to be deleting).
-
Jan 6th, 2009, 10:47 PM
#15
Re: [RESOLVED] [2005] deleting
Even though XP will allow you access to various places that Vista won't, that doesn't mean that you should use them. You should generally only be using folders that you can access through Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories. That gives you access to the Temp folder, My Documents, My Pictures, Application Data and the like. Those are really the only places that your application should need access to in the vast majority of cases.
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
|