Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - onError Command in ASP ?!?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

onError Command in ASP ?!?

 Post Reply Post Reply Page  12>
Author
neotrix View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
Post Options Post Options   Thanks (0) Thanks(0)   Quote neotrix Quote  Post ReplyReply Direct Link To This Post Topic: onError Command in ASP ?!?
    Posted: 02 May 2004 at 7:26am

Hello All,

I wanted to ask is there any onError Kindov a command in asp ?

For example, if i try to open a file using server.execute and the file is not there, could there be a command with the help of which i can write a custom error message ?

i just wrote

Server.Execute(songlyrics)
onError(Server.Execute("error.asp"))

I dont think this works, is there any command that may do this ?thanks in advance.

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 8:09am

<%
On Error Resume Next 'Resume to the next line if error

... ... ...

If Err.Number <> 0 Then  'If there is an error
 ... ... ...    'Action to perform if there is an error
End If
%>

Back to Top
neotrix View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
Post Options Post Options   Thanks (0) Thanks(0)   Quote neotrix Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 8:29am

ThaaaankkkkkkkkkkYouuuuuuuuuuuu

^_^

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 1:55pm
Won't work. Sever executes and includes are resolved when the asp page loads - not when the script executes.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 1:59pm
for includes it wont work, but with server.execute it works fine

ServerSideIncludes is Pre-processing, but Server.* Commands is not.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 5:58pm
Originally posted by dpyers dpyers wrote:

Try this.

Create 2 asp pages - calling.asp and called.asp.

In calling.asp, paste this code...

<%
'On Error Resume Next
Server.Execute("called.asp")
If Err.Number <> 0 then
 response.write Err.Number & " - " & Err.Description & "<BR>"
else
 response.write "<BR>calling program ran ok<BR>"
End If
%>

In called.asp, paste this code...

<%
response.write "<BR>Written by the program invoked by sever.execute <BR>"
%>

Run calling.asp, and you'll see the response written by called.asp

Now change the file name used in calling.asp's server.execute statement  to something else that doesn't exist - e.g. xxx.asp and rerun calling.asp.

You'll get a page load error for calling.asp.

In calling.asp you have commented out On Error Resume next...

Change line 1 from

'On Error Resume Next

To

On Error Resume Next

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 5:59pm
why did you comment On Error?

if it was a typo, what server are you running?
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 6:02pm

<STUPID action='smacks head on forehead'>

Doh! you're right. no wonder it didn't work.

</STUPID>


Lead me not into temptation... I know the short cut, follow me.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.