473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 3028
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.