PageParser.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 (null, virtualPath, 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. base.ProcessMainAttributes (atts);
  54. }
  55. protected override Type CompileIntoType ()
  56. {
  57. AspGenerator generator = new AspGenerator (this);
  58. return generator.GetCompiledType ();
  59. }
  60. internal bool EnableSessionState {
  61. get { return enableSessionState; }
  62. }
  63. internal bool ReadOnlySessionState {
  64. get { return readonlySessionState; }
  65. }
  66. internal override Type DefaultBaseType
  67. {
  68. get {
  69. return typeof (Page);
  70. }
  71. }
  72. internal override string DefaultDirectiveName
  73. {
  74. get {
  75. return "page";
  76. }
  77. }
  78. }
  79. }