473,486 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Response.Redirect causes an exeception

Hi there,
I have a very simple three page web application that I am
having trouble with. If there are any problems with any of the parameters
that are passed to the first page, I want to redirect to an error page and
display a message. However, when I call Response.Redirect, I get an
exception "Thread was being aborted". I have set the EndResponse parameter
set to true. The first page does not actually have any output, could that
be something to do with it?

Thanks.
Nov 15 '07 #1
6 1240
There's nothing wrong. When the response redirects, it aborts the processing
of the first page and sends the 302 redirect to the browser. That's normal
and prevents the first page from going on it's merry way.
--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Waldy" <so*****@microsoft.comwrote in message
news:e6**************@TK2MSFTNGP06.phx.gbl...
Hi there,
I have a very simple three page web application that I am
having trouble with. If there are any problems with any of the parameters
that are passed to the first page, I want to redirect to an error page and
display a message. However, when I call Response.Redirect, I get an
exception "Thread was being aborted". I have set the EndResponse
parameter set to true. The first page does not actually have any output,
could that be something to do with it?

Thanks.

Nov 15 '07 #2
"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
There's nothing wrong. When the response redirects, it aborts the
processing of the first page and sends the 302 redirect to the browser.
That's normal and prevents the first page from going on it's merry way.
Hi Mark,
so I cannot call Response.Redirect in a try catch block?

Regards,

Waldy.
Nov 15 '07 #3
This situation can cause issues when you have a redirect inside a try block
though. At least I think that's the issue.

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
There's nothing wrong. When the response redirects, it aborts the
processing of the first page and sends the 302 redirect to the browser.
That's normal and prevents the first page from going on it's merry way.
--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Waldy" <so*****@microsoft.comwrote in message
news:e6**************@TK2MSFTNGP06.phx.gbl...
>Hi there,
I have a very simple three page web application that I am
having trouble with. If there are any problems with any of the
parameters that are passed to the first page, I want to redirect to an
error page and display a message. However, when I call
Response.Redirect, I get an exception "Thread was being aborted". I have
set the EndResponse parameter set to true. The first page does not
actually have any output, could that be something to do with it?

Thanks.


Nov 15 '07 #4
"Waldy" <so*****@microsoft.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
so I cannot call Response.Redirect in a try catch block?
You can, but the "usual" way is to use the boolean overload:
http://msdn2.microsoft.com/en-us/lib...dt(vs.80).aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 15 '07 #5

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OY**************@TK2MSFTNGP02.phx.gbl...
"Waldy" <so*****@microsoft.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
You can, but the "usual" way is to use the boolean overload:
http://msdn2.microsoft.com/en-us/lib...dt(vs.80).aspx
I am using the parameter, but set to true. What is the default if it is not
specfied?
Nov 15 '07 #6
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OY**************@TK2MSFTNGP02.phx.gbl...
"Waldy" <so*****@microsoft.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>so I cannot call Response.Redirect in a try catch block?

You can, but the "usual" way is to use the boolean overload:
http://msdn2.microsoft.com/en-us/lib...dt(vs.80).aspx
Setting the parameter to false, stops the exception.

Thanks.
Nov 15 '07 #7

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

Similar topics

1
15268
by: Peter Kirk | last post by:
Hi there I have a program written by another company (it's a "web control" which returns a web-page: can I compare this to a servlet in the Java world?), which they think is causing problems on...
2
4441
by: FN | last post by:
I'm using User.Identity.IsAuthenticated on all my pages (from a base class), and redirecting to a login page if not authenticated. The problem is that some pages are in subfolders and others are...
10
7848
by: Anthony Williams | last post by:
Hi gang, This one looks like a bug :o( As you may or may not know, setting session management in web.config to use cookieless sessions causes the ASP.NET runtime to munge a session ID into...
2
1866
by: Sam Miller | last post by:
I have a submit button. In the event handler for that button I connect to database and write all the control values to the db. Then I have a response.redirect after the Conn.Close to leave the...
4
6624
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...
9
1961
by: postings | last post by:
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"...
4
11383
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
5
4839
by: =?Utf-8?B?d2ViZ3V5QGNvbW11bml0eS5ub3NwYW0=?= | last post by:
We have been running into some problems where using Response.Redirect causes the page to hang and it never actually redirects. Here's the scenario: User opens the page, selects an item from the...
1
2192
by: kmithu | last post by:
I am working on Asp.Net2.0 on which i have used ajax. I am well aware that Response.Write() is not supported by AJAX but what about Response.Redirect()? The error which i am getting is written...
0
7100
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
6964
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
7126
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
7175
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
7330
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...
1
4865
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
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...

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.