Wrox Programmer Forums
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 21st, 2003, 02:28 PM
Registered User
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?

Old November 25th, 2003, 02:09 PM
Registered User
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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.


Old April 14th, 2004, 04:45 PM
Registered User
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error executing child request(Server.Execute) shivendra012 ASP.NET 2.0 Professional 3 December 31st, 2008 09:32 PM
Error handling with SQL Server mike_remember SQL Server 2000 2 January 2nd, 2007 07:16 PM
Server.Execute muinaru Classic ASP Basics 9 March 13th, 2005 01:36 PM
Server.Execute RobinR Classic ASP Basics 2 October 31st, 2003 11:44 AM

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