am experiencing a problem using certain methods of the ASP file system object. It seems I can add files no problem, but if i try to edit them, or delete them, or even just access the files directly, my page just hangs and nothing happens. At this point, I have to close all my browsers, and stop and start the site, or it will not respond at all.
I am running my site in IIS 5.0 running on Windows XP (I have to test on my development machine, then push live to W2K server)
Here is a sample of the code I am using:
set objFSO = Server.CreateObject("Scrip
ting.FileS
ystemObjec
t")
if objFSO.FileExists(Server.M
apPath(str
FilePath))
then
Response.Write "about to try to delete: " & strFilePath & " <-- can't delete file"
objFSO.DeleteFile strFilePath
end if
This is the output i get:
about to try to delete: files/{55572635-9AD9-4986-
B820-49302
4D88931}_3
eyes.jpg
So i know the file exists, it is getting into the loop.
However, all that happens it the page hangs, and will not continue loading at all. I need to close the browser, and stop and start the default website in IIS to get the page to load again.
The same thing happens when i try to rename a file, here is a sample of that code:
set objFSO = Server.CreateObject("Scrip
ting.FileS
ystemObjec
t")
if objFSO.FileExists(Server.M
apPath(str
FilePath))
then
Response.Write "about to try to edit:<BR>" & Server.MapPath(strFilePath
)
set objFile = objFSO.GetFile (Server.MapPath(strFilePat
h))
end if
I have previously asked this question here:
http://www.experts-exchange.com/Web/Q_20727106.htmlI accepted the answer, as it made the problem go away.
BUT, then i went for lunch, and accepted one of microsofts XPs updates, and the problem is back. And worse yet, running the fix again did not help. I was convinced that it must be something to do with the permissions on the file and i tried changing them, the ones for the folder, permissions in IIS etc, and rebooted, and it was working for a while again, but then later stopped again, with no changes to the code.
A coworker tried it on his machine, and it was working for him as well for a while, then suddenly stopped for him as well (i'm not sure if he downloaded the update or not)
There are two other solutions suggested in the previous question:
-put the code in a .vbs file, and use create instead of server.createobject to make the FSO.
I don't think this is the answer, simply because i have done this many times using just ASP files, there should be no problem. Also, I'm writing a class, and i'd like it all to be encapsulated all within one file.
-use some error trapping to catch the error.
I don't think this is the solution, because my page is not even giving an error, or getting to the delete itself for that matter. It simply stops responding on the line:
strFilePath = Server.MapPath("/files/{54
1BB8D5-BC0
B-4537-962
0-19F67275
CAAA}_abt.
jpg")
I need to access this file to physically delete it.