PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSASPNETCustomHttpHandlerandModule/CustomHandlerandModuleProject/CustomHttpHandler.cs

#
C# | 68 lines | 34 code | 3 blank | 31 comment | 0 complexity | b98ad2f16f31a9f50035e4b15135cca7 MD5 | raw file
 1/****************************** Module Header ******************************\
 2* Module Name:  CustomHttpHandler
 3* Project:      CustomHandlerandModuleProject
 4* Copyright (c) Microsoft Corporation.
 5* 
 6* 
 7* This module implements IHttpHandler interface to write custom Http Handler
 8* to send response for the extension with .demo resource.
 9*
10*  
11* This source is subject to the Microsoft Public License.
12* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
13* All other rights reserved.
14* 
15* History:
16* 11/27/2009 11:16 AM Thomas Sun Created
17\***************************************************************************/
18#region Using directives
19using System;
20using System.Collections.Generic;
21using System.Linq;
22using System.Web;
23#endregion Using directives
24
25namespace CustomHandlerandModuleProject
26{
27    /// <summary>
28    /// Inherit IHttpHandler
29    /// </summary>
30    public class CustomHttpHandler : IHttpHandler
31    {
32        /// <summary>
33        /// Implement the ProcessRequest method
34        /// </summary>
35        /// <param name="context">Current HttpContext</param>
36        public void ProcessRequest(HttpContext context)
37        {
38            //// Get Current Context Request object
39            //HttpRequest Request = context.Request;
40            // Get Current Context Response object
41            HttpResponse Response = context.Response;
42            // Write content to client 
43            Response.Write("<html>");
44            Response.Write("<body>");
45            Response.Write("<form><h1><font color=red>This is the response for the .demo file.</font></h1>");
46            Response.Write("<br />");
47            Response.Write("<br />");
48            Response.Write("<br />");
49            Response.Write("<br />");
50            Response.Write("<br />");
51            Response.Write("<br />");
52            Response.Write("<br />");
53            Response.Write("<a href=\"default.htm\">Go Back to Default page</a>");
54            Response.Write("</form>");
55            Response.Write("</body>");
56            Response.Write("</html>");
57        }
58
59        /// <summary>
60        /// Indicate whether this custom handler is reusable in pool
61        /// </summary>
62        public bool IsReusable
63        {
64            get { return false; }
65        }
66
67    }
68}