Solved

Deleting FIle in ASP -- Permission denied Error

Posted on 2008-06-23
5
688 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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