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

Question about Response.Redirect

P: n/a
JC
Hi,

I have a simple question regarding the Response.Redirect method. Does the
server stop processing the ASP code as soon as it encounters the Redirect
command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as soon
as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to use
is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
in your first code snippet the response.write will never execute because the
page is redirected. it will always work like that. As for the second snippet
if you have response.end or not after a redirect doesn't matter. The
redirect will still execute

"JC" <no****@here.com> wrote in message
news:u8*************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a simple question regarding the Response.Redirect method. Does the
server stop processing the ASP code as soon as it encounters the Redirect
command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as soon as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to use is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC

Jul 19 '05 #2

P: n/a
http://aspfaq.com/show.asp?id=2217
http://aspfaq.com/show.asp?id=2011

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JC" <no****@here.com> wrote in message
news:u8*************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a simple question regarding the Response.Redirect method. Does the
server stop processing the ASP code as soon as it encounters the Redirect
command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as soon as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to use is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC

Jul 19 '05 #3

P: n/a
I was always told to stick Response.End after it (never told why mind).....?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Mike" <an*******@discussions.microsoft.com> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
in your first code snippet the response.write will never execute because the page is redirected. it will always work like that. As for the second snippet if you have response.end or not after a redirect doesn't matter. The
redirect will still execute

"JC" <no****@here.com> wrote in message
news:u8*************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a simple question regarding the Response.Redirect method. Does the server stop processing the ASP code as soon as it encounters the Redirect command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as

soon
as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to

use
is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC


Jul 19 '05 #4

P: n/a
JC
That's wonderful, this first link contained all the information I could wish
for.

Cheers,

JC
"Steven Burn" <pv*@noyb.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
http://aspfaq.com/show.asp?id=2217
http://aspfaq.com/show.asp?id=2011

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JC" <no****@here.com> wrote in message
news:u8*************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a simple question regarding the Response.Redirect method. Does the server stop processing the ASP code as soon as it encounters the Redirect command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as

soon
as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to

use
is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC


Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.