Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:13:12+00:00 2026-05-11T08:13:12+00:00

Response.Redirect has two overloads: public void Redirect(string url) Parameters: url: The target location. public

  • 0

Response.Redirect has two overloads:

public void Redirect(string url)  Parameters: url: The target location.
public void Redirect(string url, bool endResponse) Parameters: url: The location of the target. endResponse: Indicates whether execution of the current page should terminate.

If I call the first overload, or call the second with endResponse set to true a ThreadAbortException gets thrown.

Why would I ever want to use this approach? Isn’t this an example of using exceptions to handle program flow? (and therefore a bad thing)

And if my redirection did warrant an exeption, wouldn’t it be preferable for me to throw a more informative exception that includes the reason for the redirect?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:13:13+00:00Added an answer on May 11, 2026 at 8:13 am

    If you set endResponse to ‘true’, you are effectively saying ‘I am done with this page, ignore anything after me’.

    The reason a ‘ThreadAbortException’ is raised is so that any Finallys/Catches etc that you have written are fired, and resources are correctly cleaned up before you are sent to the next page.

    From MSDN:

    ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block. When this exception is raised, the runtime executes all the finally blocks before ending the thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Response.Write(<script>alert('Konaklama Başarıyla Eklendi')</script>); string url = NewAccommodation.aspx?mID= + mID; Response.Redirect(url); Hi, on the above
I'm looking at a web application with a Response.Redirect between two Https pages. I
My website uses Response.Redirect(~/Main/Main.aspx) type redirects all over the place. Worked flawlessly until the
I got some weird error with response.redirect() and the project wasn't building at all..
I have a web application where I am doing a Response.Redirect(Register.aspx) page in a
where used on http://localhost:8692/Contacts/Default.aspx Response.Redirect( http://www.google.com ) redirects to http://localhost:8692/Contacts/http%3a%2f%2fwww.google.com The problem just appeared
if(Request.QueryString[UserId] !== WebSecurity.CurrentUserId){ Response.Redirect(~/AdminError); } what is wrong with the above expression ? Please
I want to pass a few variables to another page. Currently I'm using response.redirect
Whats the best practice for implementing a confirmation page in .Net? I've used response.redirect(Thankyou.aspx)
What happens if the browser receives a redirect response to an ajax request?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.