Solved

Deleting FIle in ASP -- Permission denied Error

Posted on 2008-06-23
5
706 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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/…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

689 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