Ask a Question related to ASP.NET Security, Design and Development.
-
Mohammad Ali via DotNetMonster.com #1
A very persistant Access To Path Denied Error
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.
Dim myFile As File
If myFile.Exists(Server.MapPath("..\photos\family\stu dent\" &
Session("ChildId") & ".jpg")) Then
myFile.Delete(Server.MapPath("..\photos\family\stu dent\" &
Session("ChildId") & ".jpg")) ' exception thrown here
End If
file1.PostedFile.SaveAs(Server.MapPath("..\photos\ family\
student\" & Session("ChildId") & ".jpg"))
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.
--
Message posted via [url]http://www.dotnetmonster.com[/url]
Mohammad Ali via DotNetMonster.com Guest
-
Access to path is denied...
I'm trying to test/check contents of a dataset by writing it to an xml file on the server, but get this error above. The suggestion to grant... -
Access to path denied
I have a question. I am running Windows 2003 Server with Framework 1.1. I have an application that has XML config files within it that drive part... -
Access to the path is denied
This is error message I've got. Any suggestion would be appreciated. Server Error in '/WebDirectory' Application. ... -
Access to Path is denied
What account is your webservice running under? aspnet? Does aspnet have access to the directory? Maarten "Eric Levin" <eric@soundsite.com>... -
Access to the path ...\\dynamic_images is denied. What Happens???
I have designed a report that uses the CrystalReportViewer which works fine on my local machine. I created a setup to install Crystal Report in my... -
Brock Allen #2
Re: A very persistant Access To Path Denied Error
Either your application doesn't have write permissions or your application
(or someother application) is holding a lock on the file. If you don't have
the perms then enable that directory for write access to the user that your
ASP.NET app is running as. This is either the local ASPNET account on W2K
or the Network Service account on W2K3. If it's not this, then some application
has a lock on the file on the filesystem. From the other parts of your application
are you making sure to call Close or Dispose on all APIs that use the file?
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
> 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.
>
> Dim myFile As File
>
> If
> myFile.Exists(Server.MapPath("..\photos\family\stu dent\" &
> Session("ChildId") & ".jpg")) Then
>
> myFile.Delete(Server.MapPath("..\photos\family\stu dent\"
> & Session("ChildId") & ".jpg")) ' exception thrown here
>
> End If
>
> file1.PostedFile.SaveAs(Server.MapPath("..\photos\ family\
> student\" & Session("ChildId") & ".jpg"))
>
> 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.
>
Brock Allen Guest
-
Joseph MCAD #3
Re: A very persistant Access To Path Denied Error
April 8, 2005
This would be my advise also. Check all the applications that access that
file and make sure Close is called on all readers and writers! Then I would
restart the computer (if close was not called, then restarting the computer
would clear the lock) and try it again. HTH
Joseph MCAD
"Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
news:370157632482861964794688@msnews.microsoft.com ...> Either your application doesn't have write permissions or your application
> (or someother application) is holding a lock on the file. If you don't
> have the perms then enable that directory for write access to the user
> that your ASP.NET app is running as. This is either the local ASPNET
> account on W2K or the Network Service account on W2K3. If it's not this,
> then some application has a lock on the file on the filesystem. From the
> other parts of your application are you making sure to call Close or
> Dispose on all APIs that use the file?
>
> -Brock
> DevelopMentor
> [url]http://staff.develop.com/ballen[/url]
>
>
>>>> 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.
>>
>> Dim myFile As File
>>
>> If
>> myFile.Exists(Server.MapPath("..\photos\family\stu dent\" &
>> Session("ChildId") & ".jpg")) Then
>>
>> myFile.Delete(Server.MapPath("..\photos\family\stu dent\"
>> & Session("ChildId") & ".jpg")) ' exception thrown here
>>
>> End If
>>
>> file1.PostedFile.SaveAs(Server.MapPath("..\photos\ family\
>> student\" & Session("ChildId") & ".jpg"))
>>
>> 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.
>>
>
>
Joseph MCAD Guest



Reply With Quote

