Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > delete file access denied to the authorized folder(no way out)

Reply
Thread Tools

delete file access denied to the authorized folder(no way out)

 
 
nasirmajor@yahoo.com
Guest
Posts: n/a
 
      07-17-2006
dear all,
Please any urgent help regarding following code.
i have the following code

================================================== ===============
public void Delete(Object sender, DataGridCommandEventArgs e)
{
1 int Sid2 = (int)l.DataKeys[e.Item.ItemIndex];


2 //=======================

3 SqlDataReader gr = null;
4 string engpath2 = "";
5 string arbpath2 = "";

6 gr = db.GetReader("Select * from tbl_SubCat2 Where SId2="
+ Sid2 + "");

7 if (gr.Read())
8 {

9 engpath2 = gr[5].ToString();
10 arbpath2 = gr[6].ToString();

11 }

12 string strfnameeng = Server.MapPath(@"..\" + engpath2);
13 string strfnamearb = Server.MapPath(@"..\" + arbpath2);


14 File.Delete(strfnameeng);
15 File.Delete(strfnamearb);
16 gr.Close();

17 //=================================

18 db.SqlQuery = "Delete from tbl_SubCat2 Where SId2=" + Sid2 + "";

19 db.RunQuery();
20 DataBind();

}

================================================== ===============
i want the delete command of data grid to delete both the database
field and as well as the file releated to that field as well.

now this is happening separately i.e if last three lines (lines
18,19,20) are removed then file deletion code (line 3 to 16) gets
executed successfully.

and when lines (18,19,20) are again included then field gets deleted
from the database but file could not be deleted and the following error
is generated.

=======
Exception Details: System.UnauthorizedAccessException: Access to the
path 'c:\inetpub\wwwroot\Alreef\' is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS
5 or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user
(typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.
========


i did go to inetmanager and right click my site and then set the
permissions there but even then there is the same error.
why the whole programme is not going together i.e why line 18,19,20 are
causing errors when they are included with lines(3 to 16)

Please any urgent help.
Thanks in advance

 
Reply With Quote
 
 
 
 
nasirmajor@yahoo.com
Guest
Posts: n/a
 
      07-17-2006
problem solved

answer was b/w the lines

 
Reply With Quote
 
 
 
 
mausingh mausingh is offline
Junior Member
Join Date: Nov 2010
Posts: 1
 
      11-19-2010
Hi. I runned into that problem too. And after days of searching I finally found
this software: Delete Long Path File Tool.

It's GREAT. You can find it here: longpathtool
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very annoying error: Access to the path is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity Jay ASP .Net 2 08-20-2007 07:38 PM
ASP.NET is not authorized to access the requested resource Brent Burkart ASP .Net 2 06-19-2007 11:10 AM
403 Forbidden: You were denied access because: Access denied by access control list Southern Kiwi NZ Computing 6 03-19-2006 05:19 AM
You're a nutjob, Omega: Abu Ghraib was authorized all the way to the top Messenjah Digital Photography 0 05-11-2005 04:25 AM
ASP.NET is not authorized to access Brent Burkart ASP .Net 4 12-05-2003 03:17 PM



Advertisments