[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Deleting FIle in ASP -- Permission denied Error

Posted on 2008-06-23
5
Medium Priority
?
731 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 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