Solved

Unauthorized access exception

Posted on 2004-10-20
5
1,142 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

763 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

11 Experts available now in Live!

Get 1:1 Help Now