PagesSection.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. //
  2. // System.Web.Configuration.PagesSection
  3. //
  4. // Authors:
  5. // Chris Toshok ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System;
  31. using System.ComponentModel;
  32. using System.Configuration;
  33. using System.Web.UI;
  34. using System.Xml;
  35. namespace System.Web.Configuration
  36. {
  37. public sealed class PagesSection: ConfigurationSection
  38. {
  39. static ConfigurationPropertyCollection properties;
  40. static ConfigurationProperty asyncTimeoutProp;
  41. static ConfigurationProperty autoEventWireupProp;
  42. static ConfigurationProperty bufferProp;
  43. static ConfigurationProperty controlsProp;
  44. static ConfigurationProperty enableEventValidationProp;
  45. static ConfigurationProperty enableSessionStateProp;
  46. static ConfigurationProperty enableViewStateProp;
  47. static ConfigurationProperty enableViewStateMacProp;
  48. static ConfigurationProperty maintainScrollPositionOnPostBackProp;
  49. static ConfigurationProperty masterPageFileProp;
  50. static ConfigurationProperty maxPageStateFieldLengthProp;
  51. static ConfigurationProperty modeProp;
  52. static ConfigurationProperty namespacesProp;
  53. static ConfigurationProperty pageBaseTypeProp;
  54. static ConfigurationProperty pageParserFilterTypeProp;
  55. static ConfigurationProperty smartNavigationProp;
  56. static ConfigurationProperty styleSheetThemeProp;
  57. static ConfigurationProperty tagMappingProp;
  58. static ConfigurationProperty themeProp;
  59. static ConfigurationProperty userControlBaseTypeProp;
  60. static ConfigurationProperty validateRequestProp;
  61. static ConfigurationProperty viewStateEncryptionModeProp;
  62. static PagesSection ()
  63. {
  64. asyncTimeoutProp = new ConfigurationProperty ("asyncTimeout", typeof(TimeSpan), null);
  65. autoEventWireupProp = new ConfigurationProperty ("autoEventWireup", typeof(bool), true);
  66. bufferProp = new ConfigurationProperty ("buffer", typeof(bool), false);
  67. controlsProp = new ConfigurationProperty ("controls", typeof(TagPrefixCollection), null);
  68. enableEventValidationProp = new ConfigurationProperty ("enableEventValidation", typeof (bool), true);
  69. enableSessionStateProp = new ConfigurationProperty ("enableSessionState", typeof (PagesEnableSessionState), true);
  70. enableViewStateProp = new ConfigurationProperty ("enableViewState", typeof (bool), true);
  71. enableViewStateMacProp = new ConfigurationProperty ("enableViewStateMac", typeof (bool), true);
  72. maintainScrollPositionOnPostBackProp = new ConfigurationProperty ("maintainScrollPositionOnPostBack", typeof (bool), false);
  73. masterPageFileProp = new ConfigurationProperty ("masterPageFile", typeof (string), "");
  74. maxPageStateFieldLengthProp = new ConfigurationProperty ("maxPageStateFieldLength", typeof (int), -1);
  75. modeProp = new ConfigurationProperty ("compilationMode", typeof (CompilationMode), CompilationMode.Always);
  76. namespacesProp = new ConfigurationProperty ("namespacesProp", typeof (NamespaceCollection), null);
  77. pageBaseTypeProp = new ConfigurationProperty ("pageBaseType", typeof (string), "System.Web.UI.Page");
  78. pageParserFilterTypeProp = new ConfigurationProperty ("pageParserFilterTypeProp", typeof (string), "");
  79. smartNavigationProp = new ConfigurationProperty ("smartNavigation", typeof (bool), false);
  80. styleSheetThemeProp = new ConfigurationProperty ("styleSheetTheme", typeof (string), "");
  81. tagMappingProp = new ConfigurationProperty ("tagMapping", typeof (TagMapCollection), null);
  82. themeProp = new ConfigurationProperty ("theme", typeof (string), "");
  83. userControlBaseTypeProp = new ConfigurationProperty ("userControlBaseTypeProp", typeof (string), "System.Web.UI.UserControl");
  84. validateRequestProp = new ConfigurationProperty ("validateRequest", typeof (bool), true);
  85. viewStateEncryptionModeProp = new ConfigurationProperty ("viewStateEncryptionMode", typeof (ViewStateEncryptionMode), ViewStateEncryptionMode.Auto);
  86. properties = new ConfigurationPropertyCollection ();
  87. properties.Add (asyncTimeoutProp);
  88. properties.Add (autoEventWireupProp);
  89. properties.Add (bufferProp);
  90. properties.Add (enableEventValidationProp);
  91. properties.Add (enableSessionStateProp);
  92. properties.Add (enableViewStateProp);
  93. properties.Add (enableViewStateMacProp);
  94. properties.Add (maintainScrollPositionOnPostBackProp);
  95. properties.Add (masterPageFileProp);
  96. properties.Add (maxPageStateFieldLengthProp);
  97. properties.Add (modeProp);
  98. properties.Add (pageBaseTypeProp);
  99. properties.Add (pageParserFilterTypeProp);
  100. properties.Add (smartNavigationProp);
  101. properties.Add (styleSheetThemeProp);
  102. properties.Add (themeProp);
  103. properties.Add (userControlBaseTypeProp);
  104. properties.Add (validateRequestProp);
  105. properties.Add (viewStateEncryptionModeProp);
  106. }
  107. public PagesSection ()
  108. {
  109. }
  110. [TimeSpanValidator (MinValueString = "00:00:00",
  111. MaxValueString = "10675199.02:48:05.4775807")]
  112. [TypeConverter (typeof (TimeSpanSecondsConverter))]
  113. [ConfigurationProperty ("asyncTimeout", DefaultValue = "00:00:45")]
  114. public TimeSpan AsyncTimeout {
  115. get { return (TimeSpan) base [asyncTimeoutProp]; }
  116. set { base [asyncTimeoutProp] = value; }
  117. }
  118. [ConfigurationProperty ("autoEventWireup", DefaultValue = "True")]
  119. public bool AutoEventWireup {
  120. get { return (bool) base [autoEventWireupProp]; }
  121. set { base [autoEventWireupProp] = value; }
  122. }
  123. [ConfigurationProperty ("buffer", DefaultValue = "True")]
  124. public bool Buffer {
  125. get { return (bool) base [bufferProp]; }
  126. set { base [bufferProp] = value; }
  127. }
  128. [ConfigurationProperty ("compilationMode", DefaultValue = "Always")]
  129. public CompilationMode CompilationMode {
  130. get { return (CompilationMode) base [modeProp]; }
  131. set { base [modeProp] = value; }
  132. }
  133. [ConfigurationProperty ("controls")]
  134. public TagPrefixCollection Controls {
  135. get { return (TagPrefixCollection) base[controlsProp]; }
  136. }
  137. [ConfigurationProperty ("enableEventValidation", DefaultValue = "True")]
  138. public bool EnableEventValidation {
  139. get { return (bool) base[enableEventValidationProp]; }
  140. set { base[enableEventValidationProp] = value; }
  141. }
  142. [ConfigurationProperty ("enableSessionState", DefaultValue = "true")]
  143. public PagesEnableSessionState EnableSessionState {
  144. get { return (PagesEnableSessionState) base[enableSessionStateProp]; }
  145. set { base[enableSessionStateProp] = value; }
  146. }
  147. [ConfigurationProperty ("enableViewState", DefaultValue = "True")]
  148. public bool EnableViewState {
  149. get { return (bool) base[enableViewStateProp]; }
  150. set { base[enableViewStateProp] = value; }
  151. }
  152. [ConfigurationProperty ("enableViewStateMac", DefaultValue = "True")]
  153. public bool EnableViewStateMac {
  154. get { return (bool) base[enableViewStateMacProp]; }
  155. set { base[enableViewStateMacProp] = value; }
  156. }
  157. [ConfigurationProperty ("maintainScrollPositionOnPostBack", DefaultValue = "False")]
  158. public bool MaintainScrollPositionOnPostBack {
  159. get { return (bool) base[maintainScrollPositionOnPostBackProp]; }
  160. set { base [maintainScrollPositionOnPostBackProp] = value; }
  161. }
  162. [ConfigurationProperty ("masterPageFile", DefaultValue = "")]
  163. public string MasterPageFile {
  164. get { return (string) base[masterPageFileProp]; }
  165. set { base[masterPageFileProp] = value; }
  166. }
  167. [ConfigurationProperty ("maxPageStateFieldLength", DefaultValue = "-1")]
  168. public int MaxPageStateFieldLength {
  169. get { return (int) base[maxPageStateFieldLengthProp]; }
  170. set { base[maxPageStateFieldLengthProp] = value; }
  171. }
  172. [ConfigurationProperty ("namespaces")]
  173. public NamespaceCollection Namespaces {
  174. get { return (NamespaceCollection) base[namespacesProp]; }
  175. }
  176. [ConfigurationProperty ("pageBaseType", DefaultValue = "System.Web.UI.Page")]
  177. public string PageBaseType {
  178. get { return (string) base[pageBaseTypeProp]; }
  179. set { base[pageBaseTypeProp] = value; }
  180. }
  181. [ConfigurationProperty ("pageParserFilterType", DefaultValue = "")]
  182. public string PageParserFilterType {
  183. get { return (string) base[pageParserFilterTypeProp]; }
  184. set { base [pageParserFilterTypeProp] = value; }
  185. }
  186. [ConfigurationProperty ("smartNavigation", DefaultValue = "False")]
  187. public bool SmartNavigation {
  188. get { return (bool) base[smartNavigationProp]; }
  189. set { base[smartNavigationProp] = value; }
  190. }
  191. [ConfigurationProperty ("styleSheetTheme", DefaultValue = "")]
  192. public string StyleSheetTheme {
  193. get { return (string) base[styleSheetThemeProp]; }
  194. set { base[styleSheetThemeProp] = value; }
  195. }
  196. [ConfigurationProperty ("tagMapping")]
  197. public TagMapCollection TagMapping {
  198. get { return (TagMapCollection) base [tagMappingProp]; }
  199. }
  200. [ConfigurationProperty ("theme", DefaultValue = "")]
  201. public string Theme {
  202. get { return (string) base[themeProp]; }
  203. set { base[themeProp] = value; }
  204. }
  205. [ConfigurationProperty ("userControlBaseType", DefaultValue = "System.Web.UI.UserControl")]
  206. public string UserControlBaseType {
  207. get { return (string) base[userControlBaseTypeProp]; }
  208. set { base[userControlBaseTypeProp] = value; }
  209. }
  210. [ConfigurationProperty ("validateRequest", DefaultValue = "True")]
  211. public bool ValidateRequest {
  212. get { return (bool) base[validateRequestProp]; }
  213. set { base[validateRequestProp] = value; }
  214. }
  215. [ConfigurationProperty ("viewStateEncryptionMode", DefaultValue = "Auto")]
  216. public ViewStateEncryptionMode ViewStateEncryptionMode {
  217. get { return (ViewStateEncryptionMode) base [viewStateEncryptionModeProp]; }
  218. set { base [viewStateEncryptionModeProp] = value; }
  219. }
  220. protected override ConfigurationPropertyCollection Properties {
  221. get { return properties; }
  222. }
  223. [MonoTODO]
  224. protected override void DeserializeSection (XmlReader reader)
  225. {
  226. base.DeserializeSection (reader);
  227. /* XXX more here?.. */
  228. }
  229. }
  230. }
  231. #endif