Solved

Unauthorized access exception

Posted on 2004-10-20
5
1,143 Views
Last Modified: 2012-06-27
Hi,

I'm trying to delete a file using System.IO.File.Delete(file).. however I keep getting the error :

System.UnauthorizedAccessException: Access to the path .(file path here). is denied.

I've checked the permissions of the file in question and the asp.net identity has full permissions and so should be able to delete the file?

Any reason this might be happening?

0
Comment
Question by:pat333
  • 2
5 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 12361233
Is this file on the webserver?  the aspnet user has no permissions on other computers.

<identity impersonate="true" /> <-- make sure you DON'T have this in web.config
0
 

Author Comment

by:pat333
ID: 12361317
The file is on a secondary drive of the webserver. Identity impersonate is not on. The file(s) are actually put into into the location we are trying to delete from by the same webapplication.. so I don't really understand why there is an error when they come to be deleted later.
0
 
LVL 33

Accepted Solution

by:
raterus earned 125 total points
ID: 12361485
You wouldn't be using IIS 6.0 would you? (WinXP/Server 2003 runs it), IIS 6.0 doesn't use the aspnet user account, rather the "Network Service" Account.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now