PDA

View Full Version : Windows IIS ASP help


Wes
03-12-2009, 05:46 PM
Can ASP detect if a physical file is missing in the local drive (easily)?

Wes
03-12-2009, 06:25 PM
In a way, this would work. Err.Number = 0 means the file is there.

<%
Set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
Set f2 = fso.GetFile("C:\test2.img")

response.write "Error Number=" & Err.Number

%>

EDIT: Oh, this is easier:

Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(Server.MapPath("C:\testfile.img")) then Response.write "The file is there."
set fso = nothing

Now, anyone know how to verify if a HTTP link is valid?

Dr. Death
03-12-2009, 10:11 PM
http://www.devx.com/vb2themax/Tip/18670

Try there?

Wes
03-13-2009, 12:06 PM
Wow, nice! That's really simple using a Lib call.