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

  • SEARCH
  • Home
  • 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 556257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:54:03+00:00 2026-05-13T11:54:03+00:00

Anybody know why ASP.NET might not abort the current thread with a Response.End()? Update:

  • 0

Anybody know why ASP.NET might not abort the current thread with a Response.End()?

Update: Reason being that there is code, albeit not well written, that is getting executed after Response.End(). I’ve never seen a case where Response.End () didn’t stop the current thread from executing.


protected void Page_Load(object sender, EventArgs e)
{
        Response.Clear();
        Response.Redirect("somewhere", true);
        Response.End();

        //Some other code get's executed here
}
  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-13T11:54:03+00:00Added an answer on May 13, 2026 at 11:54 am

    As you’ve pointed out, the method Response.End is defined as:

    public void End()
    {
      if (this._context.IsInCancellablePeriod) {
        InternalSecurityPermissions.ControlThread.Assert();
        Thread.CurrentThread.Abort(new HttpApplication.CancelModuleException(false));
      }
      else if (!this._flushing)
      {
        this.Flush();
        this._ended = true;
        if (this._context.ApplicationInstance != null) {
          this._context.ApplicationInstance.CompleteRequest();
        }
      }
    }
    

    Debugging a fairly simple web app with a break point in the Page_Load method, I can see the call stack includes the line:

    System.Web.dll! System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step = {System.Web.HttpApplication.CallHandlerExecutionStep}, ref bool completedSynchronously = true) + 0x4c bytes

    Reflecting into CallHandlerExecutionStep I can see that the property IsCancellable is defined as:

    bool HttpApplication.IExecutionStep.IsCancellable {
      get {
        return !(this._application.Context.Handler is IHttpAsyncHandler);
      }
    }
    

    The default handler for .aspx pages is the output from the PageHandlerFactory which implement IHttpHandler, not IHttpAsyncHandler – which would result in IsCancellable returning true (as indeed it does in my test app).

    Have you configured a different HttpHandler in either your root web.config or one further up the stack to use an Async Handler instead? Are you using Update Panels with Partial Postbacks for example?

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

Sidebar

Related Questions

Does anybody know of a commercially supported distributable web server that can host ASP.NET
Does anybody know of an up to date tutorial on using Ajax with ASP.net
Does anybody know of an easy to implement site search engine for asp.net? The
Does anybody know what tool used while podcasts were recorded here: http://www.asp.net/mvc/application-development/ For example
Does anybody know how I use asp.net mvc routing to force any non ajax
Does anybody know how to redirect to another server/solution using ASP.NET MVC? Something like
I am trying to create a formmailer using ASP.net C#. Does anybody know of
I have a button on an ASP.Net page that will call Response.Redirect back to
I have an ASP.NET AJAX page that for some reason on the LIVE version
does anybody know how to make a numericupdown control for asp. There's one for

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.