
CompleteRequest is an HttpApplication instance method. It signals to the ASP.NET runtime that no further processing on the request is needed. It can be used on sites that do not use pages or ASHX files.
This C# page uses the CompleteRequest method in ASP.NET. This method signals that the ASP.NET runtime should stop processing the request.

First, this code snippet is part of the Global.asax file, which you can add by going to Add -> Global Application Class. It uses the Application_BeginRequest event handler, which is run on every request. In the implementation, we write a string to the response, and then call CompleteRequest. When we call CompleteRequest, any page (such as WebForm1.aspx) that is browsed to will not be rendered. The request is terminated before that point because of CompleteRequest.
Method that uses CompleteRequest [ASP.NET]
using System;
using System.Web;
namespace WebApplication5
{
public class Global : HttpApplication
{
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Write some content.
base.Response.Write("Write");
// Finish the request.
// ... No web forms will be used in the response.
base.CompleteRequest();
}
}
}
Text content of /WebForm1.aspx
(Some markup was omitted.)
Test
Result of visiting /WebForm1.aspx
WriteWhat happens if we comment out "base.CompleteRequest();"? If we remove the method call to CompleteRequest, the string "Write" and also the contents of /WebForm1.aspx will be written to the response. The page will have the text "Write" and also "Test" after that. The request will not be completed before the /WebForm1.aspx file is rendered.

Why is CompleteRequest on the HttpApplication type important? One use for CompleteRequest is that you can implement your entire request processing logic inside BeginRequest and in other C# files. You can actually avoid having any *.aspx files at all in your website. This can provide some performance benefits.
As an aside, Dot Net Perls used to be implemented in this way. All requests are intercepted through Application_BeginRequest and then at the end of that method, CompleteRequest is called. All pages are written from an in-memory cache and very little processing is done. The site treats pages and images in the same way.

The CompleteRequest method in the ASP.NET Framework is an important method to use when you want to terminate all further processing after a certain point. You do not need to do anything further after CompleteRequest has been called and no *.aspx pages will be rendered after that point.
ASP.NET Tutorials