473,397 Members | 2,028 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,397 software developers and data experts.

response.redirect & response.end

Just a quick question...

When I do a "response.redirect" from a source webpage to a destination
webpage, does the code on the source webpage carry on executing unless
I put a "response.end" straight the "response.redirect" command?

I know about server.transfer BTW, I just want to know what happens in
this instance...

Many thanks!

Alex

Nov 19 '05 #1
9 1956
po******@alexshirley.com wrote:
Just a quick question...

When I do a "response.redirect" from a source webpage to a destination
webpage, does the code on the source webpage carry on executing unless
I put a "response.end" straight the "response.redirect" command?

I know about server.transfer BTW, I just want to know what happens in
this instance...

Many thanks!

Alex


Look at the second argument to Response.Redirect(). It lets you choose.
If you don't supply a second argumnet, the default is to end the
response immediately.

Be aware that it terminates the current request by using a
ThreadAbortException, so if you're inside a Try/Catch/Finally then some
of your Catch code may run (depending on how specific your Catch filter
is), and your finally code will run.

Damien

Nov 19 '05 #2
Damien wrote:

Be aware that it terminates the current request by using a
ThreadAbortException, so if you're inside a Try/Catch/Finally then
some of your Catch code may run (depending on how specific your Catch
filter is), and your finally code will run.


The Finally code will always run regardless. ;)

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com


Nov 19 '05 #3
JIMCO Software wrote:
Damien wrote:

Be aware that it terminates the current request by using a
ThreadAbortException, so if you're inside a Try/Catch/Finally then
some of your Catch code may run (depending on how specific your Catch
filter is), and your finally code will run.


The Finally code will always run regardless. ;)

Agreed. I'm guessing you felt my wording a bit ambiguous, so the OP may
have done too.

As an aside, does anyone know if the SEH/Finally code would run if the
Thread was aborted using TerminateThread()?

Cheers,

Damien

Nov 19 '05 #4
Thanks guys!

Damien said:
Look at the second argument to Response.Redirect(). It lets you choose.
If you don't supply a second argumnet, the default is to end the
response immediately.


Thanks, I see the parameter now (doh!).

Can I just reconfirm here, by NOT setting an argument in
response.redirect the code will immediately halt execution of the page
it is executing from (coundn't find anything in the documentation about
the default behavior).

It's just seems my app appears to intermittently execute code after
this command sometimes (esp when clicking buttons with a redirector),
tricky thing really.

Cheers

Alex

Nov 19 '05 #5
Damien wrote:

As an aside, does anyone know if the SEH/Finally code would run if the
Thread was aborted using TerminateThread()?


I'm not sure. Based on the documentation on that API, I'd say that it would
not.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com


Nov 19 '05 #6
Just in case this got missed, sorry to repost:

Can I just reconfirm here, by NOT setting an argument in
response.redirect the code will immediately halt execution of the page
it is executing from (coundn't find anything in the documentation about

the default behavior).

It's just seems my app appears to intermittently execute code after
this command sometimes (esp when clicking buttons with a redirector),
tricky thing really.

Cheers

Alex

Nov 19 '05 #7
po******@alexshirley.com wrote:
Just in case this got missed, sorry to repost:

Can I just reconfirm here, by NOT setting an argument in
response.redirect the code will immediately halt execution of the page
it is executing from (coundn't find anything in the documentation
about

the default behavior).


Yes. Response.Redirect calls Response.End which then makes a call into the
runtime to halt execution of the current thread.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com


Nov 19 '05 #8
the actual code for Redirect(url) is:

public void Redirect(string url)
{
this.Redirect(url,true);
}

setting endResponse to true causes Response.End() to be called.
Response.End() just kills the current thread (in most cases).

-- bruce (sqlwork.com)
<po******@alexshirley.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Just in case this got missed, sorry to repost:

Can I just reconfirm here, by NOT setting an argument in
response.redirect the code will immediately halt execution of the page
it is executing from (coundn't find anything in the documentation about

the default behavior).

It's just seems my app appears to intermittently execute code after
this command sometimes (esp when clicking buttons with a redirector),
tricky thing really.

Cheers

Alex

Nov 19 '05 #9
Thankyou very much!

Cheers

Alex

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bill | last post by:
I've got an application that I want to redirect to another file while keeping the location of the file hidden. In other words, WEBROOT.COM/REDIT.ASP?a=14 is going to display the contents of...
4
by: TomT | last post by:
Hi.. I'm redirecting users to another page using: response.redirect("newpage.asp") this works... But I need to add a variable to the page specified.. IE: newpage.asp?id=JobID
0
by: Sam | last post by:
I am trying to pinpoint down a random response.redirect error message. "Object Moved To Here". I think it is due to the following order in which I am assigning cookies and redirecting: 1. I set...
3
by: Raterus | last post by:
Anyone know how I can figure out the figure out the response.redirect trail a browser goes through when I'm using response.redirect on the server. Right now Internet Explorer just automatically...
4
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we...
10
by: GreggTB | last post by:
I've got an page (LOGIN.ASPX) that receives the user's login information. During the page load, it checks the credentials against a database and, if validation is successful, creates an instance of...
4
by: Matt MacDonald | last post by:
Hi everyone, I'm seeing this problem more and more often. Not sure if it's me or IIS or both. Here's the general scenario: I have an ASP.net app that is running and I try to navigate to...
16
by: wizard04 | last post by:
On my WinXP machine, with both IE6 and Firefox 1.0, response.redirect and server.transfer take about a minute. But on my WinNT machine with IE5.5, it works instantly. What's going on?
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.