473,804 Members | 2,201 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 1989
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
2000
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
6687
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
12213
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
7970
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
4354
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
9715
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
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10352
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
9175
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...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.