//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ /* * Synchronous Http request handler interface * * Copyright (c) 1998 Microsoft Corporation */ namespace System.Web { /// /// Provides a synchronous Http request handler interface. /// internal class HttpNotFoundHandler : IHttpHandler { internal HttpNotFoundHandler() { } /// /// Drives web processing execution. /// public void ProcessRequest(HttpContext context) { PerfCounters.IncrementCounter(AppPerfCounter.REQUESTS_NOT_FOUND); throw new HttpException(404, SR.GetString(SR.Path_not_found, context.Request.Path)); } /// /// Indicates whether an HttpNotFoundHandler instance can be recycled and used /// for another request. /// public bool IsReusable { get { return true; } } } internal class HttpForbiddenHandler : IHttpHandler { internal HttpForbiddenHandler() { } /// /// Drives web processing execution. /// public void ProcessRequest(HttpContext context) { PerfCounters.IncrementCounter(AppPerfCounter.REQUESTS_NOT_FOUND); throw new HttpException(403, SR.GetString(SR.Path_forbidden, context.Request.Path)); } /// /// Indicates whether an HttpForbiddenHandler instance can be recycled and used /// for another request. /// public bool IsReusable { get { return true; } } } /// /// Provides a synchronous Http request handler interface. /// internal class HttpMethodNotAllowedHandler : IHttpHandler { internal HttpMethodNotAllowedHandler() { } /// /// Drives /// web processing execution. /// public void ProcessRequest(HttpContext context) { throw new HttpException(405, SR.GetString(SR.Path_forbidden, context.Request.HttpMethod)); } /// /// Indicates whether an HttpForbiddenHandler instance can be recycled and used /// for another request. /// public bool IsReusable { get { return true; } } } /// /// Provides a synchronous Http request handler interface. /// internal class HttpNotImplementedHandler : IHttpHandler { internal HttpNotImplementedHandler() { } /// /// Drives web processing execution. /// public void ProcessRequest(HttpContext context) { throw new HttpException(501, SR.GetString(SR.Method_for_path_not_implemented, context.Request.HttpMethod, context.Request.Path)); } /// /// Indicates whether an HttpNotImplementedHandler instance can be recycled and /// used for another request. /// public bool IsReusable { get { return true; } } } }