Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

IO.File.Delete gives me Unauthorized Access Exception

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
M K - 28 Jul 2004 13:57 GMT
Just to be clear, I've pasted the message below. I'm doing:
IF IO.File.Exists(filePath) then io.File.Delete(filePath)
It pukes. I know it's security. What I'm trying to do is download a file. I want it to overright the file. (Version checking is done already.) I'm sure it's something I'm missing. What can I check?

Here's the message, just to be clear.
System.UnauthorizedAccessException: Access to the path "C:\Documents and Settings\mark.CENTURYCOLOR\My Documents\Visual Studio Projects\Data.Match\bin\DataMatch.exe" is denied.
  at System.IO.__Error.WinIOError(Int32 errorCode, String str)
  at System.IO.File.Delete(String path)
  at DataMatchUpdater.DmUpdater.WriteFiles() in C:\Documents and Settings\mark.CENTURYCOLOR\My Documents\Visual Studio Projects\DataMatchUpdater\DMUpdater.vb:line 187
Rhett Gong [MSFT] - 29 Jul 2004 08:43 GMT
Hi,
From your description, this file is a local file (not readonly)  and you have all
permissions to it.  And you get this exception when you are trying to delete a file
which you are downloading at the same time.

From your exception msg, we can see that the msg is throwed by WriteFiles. From call
stack, I assume that you write this function and  you are trying to write something to
the file. Could you add an assert before the WriteFiles to see if the file exists? If
this file is created after the original file is deleted. I suggest you checking the
permission of the newly created file before going to WriteFiles.    

Please let me know what you get after apply this. Thanks.

Best regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.