By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,743 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,743 IT Pros & Developers. It's quick & easy.

stop server.execute in the middle

P: n/a
JT
is it possible to somehow "jump out of" an ASP page that is executed from
another page via the Server.Execute method?

on the page being executed i have several instances where i need to stop the
execution and immediately shoot back to the calling page without running
through the rest of the code on the executed page.

im not sure if this is possible but any help would be much appreciated.

tia
jt
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Only if you include code in the page that you're executing to have it halt
in there. What criteria are you using to decide whether or not you'd like
the code to continue?

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
is it possible to somehow "jump out of" an ASP page that is executed from
another page via the Server.Execute method?

on the page being executed i have several instances where i need to stop the execution and immediately shoot back to the calling page without running
through the rest of the code on the executed page.

im not sure if this is possible but any help would be much appreciated.

tia
jt

Jul 19 '05 #2

P: n/a
JT
thanks for the reply - what is the code to halt an executed page?

for example, if i encounter an error on the executed page, i want to stop
the execution and bounce back to the calling page.

something like RETURN???

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#0**************@TK2MSFTNGP11.phx.gbl...
Only if you include code in the page that you're executing to have it halt
in there. What criteria are you using to decide whether or not you'd like
the code to continue?

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
is it possible to somehow "jump out of" an ASP page that is executed from another page via the Server.Execute method?

on the page being executed i have several instances where i need to stop

the
execution and immediately shoot back to the calling page without running
through the rest of the code on the executed page.

im not sure if this is possible but any help would be much appreciated.

tia
jt


Jul 19 '05 #3

P: n/a
Assuming vbscript:

Unfortunately, VBScript doesn't have the error trapping capabilities of VB.
So, you can't just do a "on error GOTO SOMEWHERE" and have "exit sub" at the
somewhere label. But you can do:

On Error Resume Next
If Err.Number <> 0 Then Exit Sub

Example:

page1.asp:
<%
server.execute "page2.asp"
response.write "<br>page 2 was executed."
%>

page2.asp:
<%
Call Main()
Sub Main()
on error resume next
response.write "test line 1<br>"
x = 1/0
If err.number <> 0 Then Exit Sub
response.write "test line2"
End Sub
%>

Ray at work


"JT" <je******@sppinc.net> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
thanks for the reply - what is the code to halt an executed page?

for example, if i encounter an error on the executed page, i want to stop
the execution and bounce back to the calling page.

something like RETURN???

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#0**************@TK2MSFTNGP11.phx.gbl...
Only if you include code in the page that you're executing to have it halt
in there. What criteria are you using to decide whether or not you'd like the code to continue?

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
is it possible to somehow "jump out of" an ASP page that is executed from another page via the Server.Execute method?

on the page being executed i have several instances where i need to stop the
execution and immediately shoot back to the calling page without

running through the rest of the code on the executed page.

im not sure if this is possible but any help would be much appreciated.
tia
jt



Jul 19 '05 #4

P: n/a
JT
but im not executing a sub - im executing an ASP page.

your advice would work if i were using 'includes' rather than server.execute

i tried making the asp page called by the server.execute a subroutine - but
when i do this, it doesn't get executed???

for this case i want to avoid using an includes file

i must be misunderstanding something b/c this seems like it should be so
simple

thanks again
jt

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
Assuming vbscript:

Unfortunately, VBScript doesn't have the error trapping capabilities of VB. So, you can't just do a "on error GOTO SOMEWHERE" and have "exit sub" at the somewhere label. But you can do:

On Error Resume Next
If Err.Number <> 0 Then Exit Sub

Example:

page1.asp:
<%
server.execute "page2.asp"
response.write "<br>page 2 was executed."
%>

page2.asp:
<%
Call Main()
Sub Main()
on error resume next
response.write "test line 1<br>"
x = 1/0
If err.number <> 0 Then Exit Sub
response.write "test line2"
End Sub
%>

Ray at work


"JT" <je******@sppinc.net> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
thanks for the reply - what is the code to halt an executed page?

for example, if i encounter an error on the executed page, i want to stop
the execution and bounce back to the calling page.

something like RETURN???

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#0**************@TK2MSFTNGP11.phx.gbl...
Only if you include code in the page that you're executing to have it

halt in there. What criteria are you using to decide whether or not you'd like the code to continue?

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> is it possible to somehow "jump out of" an ASP page that is executed

from
> another page via the Server.Execute method?
>
> on the page being executed i have several instances where i need to stop the
> execution and immediately shoot back to the calling page without running > through the rest of the code on the executed page.
>
> im not sure if this is possible but any help would be much appreciated. >
> tia
> jt
>
>



Jul 19 '05 #5

P: n/a
You could just encapsulate your code in a sub and call it at the top of the
page.

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
but im not executing a sub - im executing an ASP page.

your advice would work if i were using 'includes' rather than server.execute
i tried making the asp page called by the server.execute a subroutine - but when i do this, it doesn't get executed???

for this case i want to avoid using an includes file

i must be misunderstanding something b/c this seems like it should be so
simple

thanks again
jt

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
Assuming vbscript:

Unfortunately, VBScript doesn't have the error trapping capabilities of

VB.
So, you can't just do a "on error GOTO SOMEWHERE" and have "exit sub" at

the
somewhere label. But you can do:

On Error Resume Next
If Err.Number <> 0 Then Exit Sub

Example:

page1.asp:
<%
server.execute "page2.asp"
response.write "<br>page 2 was executed."
%>

page2.asp:
<%
Call Main()
Sub Main()
on error resume next
response.write "test line 1<br>"
x = 1/0
If err.number <> 0 Then Exit Sub
response.write "test line2"
End Sub
%>

Ray at work


"JT" <je******@sppinc.net> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
thanks for the reply - what is the code to halt an executed page?

for example, if i encounter an error on the executed page, i want to stop the execution and bounce back to the calling page.

something like RETURN???

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:#0**************@TK2MSFTNGP11.phx.gbl...
> Only if you include code in the page that you're executing to have it
halt
> in there. What criteria are you using to decide whether or not
you'd like
> the code to continue?
>
> Ray at work
>
> "JT" <je******@sppinc.net> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
> > is it possible to somehow "jump out of" an ASP page that is
executed from
> > another page via the Server.Execute method?
> >
> > on the page being executed i have several instances where i need

to stop
> the
> > execution and immediately shoot back to the calling page without

running
> > through the rest of the code on the executed page.
> >
> > im not sure if this is possible but any help would be much

appreciated.
> >
> > tia
> > jt
> >
> >
>
>



Jul 19 '05 #6

P: n/a
JT
ok sorry silly me i think i got it now

i made my executed page into a subroutine but i forgot to add a call to the
subroutine

asp1.asp :

Server.Execute("../asp2.asp")
asp2.asp :

Call AddPayment()

Sub AddPayment()

if error = true then
exit sub
end if

do something else

End Sub

thanks for the help
jt
"JT" <je******@sppinc.net> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
but im not executing a sub - im executing an ASP page.

your advice would work if i were using 'includes' rather than server.execute
i tried making the asp page called by the server.execute a subroutine - but when i do this, it doesn't get executed???

for this case i want to avoid using an includes file

i must be misunderstanding something b/c this seems like it should be so
simple

thanks again
jt

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
Assuming vbscript:

Unfortunately, VBScript doesn't have the error trapping capabilities of

VB.
So, you can't just do a "on error GOTO SOMEWHERE" and have "exit sub" at

the
somewhere label. But you can do:

On Error Resume Next
If Err.Number <> 0 Then Exit Sub

Example:

page1.asp:
<%
server.execute "page2.asp"
response.write "<br>page 2 was executed."
%>

page2.asp:
<%
Call Main()
Sub Main()
on error resume next
response.write "test line 1<br>"
x = 1/0
If err.number <> 0 Then Exit Sub
response.write "test line2"
End Sub
%>

Ray at work


"JT" <je******@sppinc.net> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
thanks for the reply - what is the code to halt an executed page?

for example, if i encounter an error on the executed page, i want to stop the execution and bounce back to the calling page.

something like RETURN???

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:#0**************@TK2MSFTNGP11.phx.gbl...
> Only if you include code in the page that you're executing to have it
halt
> in there. What criteria are you using to decide whether or not
you'd like
> the code to continue?
>
> Ray at work
>
> "JT" <je******@sppinc.net> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
> > is it possible to somehow "jump out of" an ASP page that is
executed from
> > another page via the Server.Execute method?
> >
> > on the page being executed i have several instances where i need

to stop
> the
> > execution and immediately shoot back to the calling page without

running
> > through the rest of the code on the executed page.
> >
> > im not sure if this is possible but any help would be much

appreciated.
> >
> > tia
> > jt
> >
> >
>
>



Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.