473,796 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

response.redire ct & response.end

Just a quick question...

When I do a "response.redir ect" from a source webpage to a destination
webpage, does the code on the source webpage carry on executing unless
I put a "response.e nd" straight the "response.redir ect" 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 1988
po******@alexsh irley.com wrote:
Just a quick question...

When I do a "response.redir ect" from a source webpage to a destination
webpage, does the code on the source webpage carry on executing unless
I put a "response.e nd" straight the "response.redir ect" 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.Redire ct(). 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
ThreadAbortExce ption, 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
ThreadAbortExce ption, 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
ThreadAbortExce ption, 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.Redire ct(). 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.redire ct 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.redire ct 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******@alexsh irley.com wrote:
Just in case this got missed, sorry to repost:

Can I just reconfirm here, by NOT setting an argument in
response.redire ct 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.Redire ct 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(u rl,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******@alexs hirley.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Just in case this got missed, sorry to repost:

Can I just reconfirm here, by NOT setting an argument in
response.redire ct 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
1983
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 file WEBROOT.COM/SECURE12954 without the user knowing they are in the /SECURE12954 subdir.
4
14632
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
1450
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 the cookie - Response.Cookies("name").Values ("val") = ... 2. I redirect response.redirect("...") Is this legal. The problem is 85% of the time it works so I need somebody else's opinion.
3
1998
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 redirects, I need to figure out, on the client, the pages it is being told to go to. Yes I know I can look in the address bar, but say the Response object is redirecting 3 or 4 pages per Request. I need this for a debugging issue. Thanks --Michael
4
6685
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 wanted to redirect to an error page. But, this doesn't seem to work. So, another question is, if an exception is thrown and caught in a catch block in Application_Start and/or Session_Start, what do we or can we do with it?
10
12212
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 an object that stores the user's basic profile data (username, user type, associated sales region, etc.). I've been taking this user info and placing it in the Session object like so... Session = user;
4
5495
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 another page using a response.redirect(some page), all I get is a blank page. The url in the browser hasn't changed at all and none of the page validation takes place. The site works fine when hosted locally (WinXP IIS5) but when I move it to the web...
16
7968
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
4350
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). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10013
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.