Solved

Deleting FIle in ASP -- Permission denied Error

Posted on 2008-06-23
5
678 Views
Last Modified: 2010-04-21
Hi,

I am working on Project in ASP

Whenever I delete file from the ASP code.

I get the Permission denied error.

Error Detail:

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/AspImageProject/browse1.asp, line 26





How to resolve this. The code I am using is below


If Request.Form("btnDelete") = DeleteButtonLabel Then
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    For Each strFileName In Request.Form("delete")
        objFSO.DeleteFile(Server.MapPath(ImageFilePath & "/" & _
            strFileName))
    Next

    Set objFSO = Nothing
End If


Many Thanks

If Request.Form("btnDelete") = DeleteButtonLabel Then

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
 

    For Each strFileName In Request.Form("delete")

        objFSO.DeleteFile(Server.MapPath(ImageFilePath & "/" & _

            strFileName))

    Next
 

    Set objFSO = Nothing

End If

Open in new window

0
Comment
Question by:tia_kamakshi
  • 3
5 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 21846285
How was the file created?  

If it was not created using the script then the IIS user account does not have access to delete files.  You would need to go to the folder where you want to delete files and update your IIS user to have permissions to delete files from this directory.

I had similar issues with adding/editing files from scripts.  You just need to update the permissions to that folder (for whatever user that is running the webserver, usually IIS something).
0
 
LVL 10

Accepted Solution

by:
Dxpert earned 500 total points
ID: 21846292
This error is happening because the computer account which ASP runs under has no rights to delete the file or the file is in use. If you are sure that the file is not in use, then you can try changing the permissions on the directory where the file is.  Give the IUSR_<ComputerName> privileges to delete the file.
0
 
LVL 10

Expert Comment

by:Dxpert
ID: 21846299
same time posts, cool :-)
0
 

Author Closing Comment

by:tia_kamakshi
ID: 31469735
Many Thanks
0
 
LVL 10

Expert Comment

by:Dxpert
ID: 21847712
Cool... this question points raised me to a "Master" rank in ASP... :-)
Thanks! Glad I could help...
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

Title # Comments Views Activity
Translate a cURL request to Classic ASP 4 418
Live mode in DW, need to creae Session 4 78
Need help to rewrite script 3 68
asp syntax 3 38
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 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

15 Experts available now in Live!

Get 1:1 Help Now