Solved

Deleting FIle in ASP -- Permission denied Error

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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/…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

19 Experts available now in Live!

Get 1:1 Help Now