PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms 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
  19. using System;
  20. using System.Collections.Generic;
  21. using System.Linq;
  22. using System.Web;
  23. #endregion Using directives
  24. namespace CustomHandlerandModuleProject
  25. {
  26. /// <summary>
  27. /// Inherit IHttpHandler
  28. /// </summary>
  29. public class CustomHttpHandler : IHttpHandler
  30. {
  31. /// <summary>
  32. /// Implement the ProcessRequest method
  33. /// </summary>
  34. /// <param name="context">Current HttpContext</param>
  35. public void ProcessRequest(HttpContext context)
  36. {
  37. //// Get Current Context Request object
  38. //HttpRequest Request = context.Request;
  39. // Get Current Context Response object
  40. HttpResponse Response = context.Response;
  41. // Write content to client
  42. Response.Write("<html>");
  43. Response.Write("<body>");
  44. Response.Write("<form><h1><font color=red>This is the response for the .demo file.</font></h1>");
  45. Response.Write("<br />");
  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("<a href=\"default.htm\">Go Back to Default page</a>");
  53. Response.Write("</form>");
  54. Response.Write("</body>");
  55. Response.Write("</html>");
  56. }
  57. /// <summary>
  58. /// Indicate whether this custom handler is reusable in pool
  59. /// </summary>
  60. public bool IsReusable
  61. {
  62. get { return false; }
  63. }
  64. }
  65. }