p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Professional (http://p2p.wrox.com/forumdisplay.php?f=63)
-   -   Server.Execute() Error handling (http://p2p.wrox.com/showthread.php?t=6503)

nickelsberry November 21st, 2003 02:28 PM

Server.Execute() Error handling
Im trying to do some error handling when using Server.Execute, when it tries to execute a file that is not found, it isnt returning an error. I dont want to use the file system object to test if the file exists before hand because of the cost of creating the object and doing the test every time the page runs. shouldnt server.execute return an error code if the page is not found?

nickelsberry November 25th, 2003 02:09 PM

It seems to work if i do the following, but it doesnt make much sense to me.

If Server.Execute(theFile) Then
  Response.Write("write message here")
End If

The response.write only seems to run when theFile does not exist. Can anyone explain why this works? I have no idea.


pauldoh April 14th, 2004 04:45 PM

According to Microsoft the Server.Execute method does not have any return values.

I found this to work

public function myfunction
on error resume next

Server.Execute "somefile.asp"
if err.number <> 0 then
 response.write "an error occurred"
end if

end function

All times are GMT -4. The time now is 07:14 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.