Response.Redirect causes an exeception

  • Thread starter Thread starter Waldy
  • Start date Start date
W

Waldy

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.
 
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.
 
Mark Fitzpatrick said:
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.
 
This situation can cause issues when you have a redirect inside a try block
though. At least I think that's the issue.
 
Back
Top