468,278 Members | 1,582 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

Question about Response.Redirect

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
4 2760
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
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
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
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.

Similar topics

2 posts views Thread by JPElectron | last post: by
5 posts views Thread by Dot net work | last post: by
reply views Thread by mike parr | last post: by
1 post views Thread by Axel Dahmen | last post: by
10 posts views Thread by glenn | last post: by
1 post views Thread by Kevin Blount | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.