HTTPNotFoundHandler.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / HTTPNotFoundHandler.cs / 1 / HTTPNotFoundHandler.cs

                            //------------------------------------------------------------------------------ 
// 
//     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; } 
        }
    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------ 
// 
//     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; } 
        }
    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK