472,791 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

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 2982
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JPElectron | last post by:
I'm looking for a way to redirect based on when more than one condition is met, I think I proably need some if/then statements? Can someone provide a sample code or point me in the right...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
5
by: Dot net work | last post by:
Hi, Is it possible to do a form POST and also redirect to a different url, using code behind? I don't think response.redirect will work because that doesn't post form data. I don't think...
0
by: mike parr | last post by:
I am using Forms authentication for the first time, and I'm having problems with it. I have 3 pages relating to the login, default.aspx, default_new_user.aspx and default_user.aspx. ...
1
by: Axel Dahmen | last post by:
Hi, I'm wondering what is Response.Redirect(string) equivalent to: Response.Redirect(string,true) - or - Response.Redirect(string,false) ? The MSDN Library is unclear on this.
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
5
by: bienwell | last post by:
Hi all, I have a problem with using myCommand.ExecuteScalar(). My question is : If the Web setup is incorrect, does it make command ExecuteScalar() work improperly ?? In my program, I was...
1
by: Kevin Blount | last post by:
Background: My script is designed to only allow the downloading of a file if a cookie exists to say that someone is logged into my companies site. A colleague set up a test area the extension...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.