PageParser.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // System.Web.UI.PageParser
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Web;
  12. using System.Web.Compilation;
  13. namespace System.Web.UI
  14. {
  15. public sealed class PageParser : TemplateControlParser
  16. {
  17. bool enableSessionState = true;
  18. bool readonlySessionState;
  19. public static IHttpHandler GetCompiledPageInstance (string virtualPath,
  20. string inputFile,
  21. HttpContext context)
  22. {
  23. PageParser pp = new PageParser ();
  24. IHttpHandler h = (IHttpHandler) pp.GetCompiledInstance (virtualPath, inputFile, context);
  25. return h;
  26. }
  27. internal override void ProcessMainAttributes (Hashtable atts)
  28. {
  29. string enabless = GetString (atts, "EnableSessionState", null);
  30. if (enabless != null) {
  31. readonlySessionState = (String.Compare (enabless, "readonly", true) == 0);
  32. if (readonlySessionState == true || String.Compare (enabless, "true", true) == 0) {
  33. enableSessionState = true;
  34. } else if (String.Compare (enabless, "false", true) == 0) {
  35. enableSessionState = false;
  36. } else {
  37. ThrowParseException ("Invalid value for EnableSessionState: " + enabless);
  38. }
  39. }
  40. // Ignored by now
  41. GetString (atts, "Buffer", null);
  42. GetString (atts, "ClientTarget", null);
  43. GetString (atts, "CodePage", null);
  44. GetString (atts, "ContentType", null);
  45. GetString (atts, "Culture", null);
  46. GetString (atts, "EnableViewStateMac", null);
  47. GetString (atts, "ErrorPage", null);
  48. GetString (atts, "LCID", null);
  49. GetString (atts, "ResponseEncoding", null);
  50. GetString (atts, "Trace", null);
  51. GetString (atts, "TraceMode", null);
  52. GetString (atts, "UICulture", null);
  53. GetBool (atts, "ValidateRequest", true);
  54. base.ProcessMainAttributes (atts);
  55. }
  56. protected override Type CompileIntoType ()
  57. {
  58. AspGenerator generator = new AspGenerator (this);
  59. return generator.GetCompiledType ();
  60. }
  61. internal bool EnableSessionState {
  62. get { return enableSessionState; }
  63. }
  64. internal bool ReadOnlySessionState {
  65. get { return readonlySessionState; }
  66. }
  67. internal override Type DefaultBaseType
  68. {
  69. get {
  70. return typeof (Page);
  71. }
  72. }
  73. internal override string DefaultDirectiveName
  74. {
  75. get {
  76. return "page";
  77. }
  78. }
  79. }
  80. }