A very persistant Access To Path Denied Error

P

paritycheck

Hi Guys,

I'm stuck with a terribly persistant "Access to the path *** is denied"
problem. I'm trying to upload a foile using the file control. The code
checks if a file of the same name as uploaded exists and if so,
attempts to delete the file and then uploads the new file.

<STRONG>
Dim myFile As File

If myFile.Exists(Server.MapPath("..\photos\family\student\"
& Session("ChildId") & ".jpg")) Then

myFile.Delete(Server.MapPath("..\photos\family\student\" &
Session("ChildId") & ".jpg")) ' exception thrown here

End If


file1.PostedFile.SaveAs(Server.MapPath("..\photos\family\student\" &
Session("ChildId") & ".jpg"))


</STRONG>

However I keep getting the following error "Access to path ** is
denied"

I've given ASP.NET all complete access to the folder where the file is
to be uploaded. I've even turned on impersonation in the webconfig file
and it still doesn't work. It makes no sense. I've tried everything an
still no luck. Any code snippets or suggetsions for this problem would
be highly appreciated.
 
G

Guest

Is your settings in IIS set to "Enable parent paths" for that directory? You
can find this in the properties of your virtual directory on the Directory
tab > Click Configuration > and on the Options tab.

Cheers,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top