PagesSection.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. PropertyHelper.TimeSpanSecondsConverter,
  66. PropertyHelper.PositiveTimeSpanValidator,
  67. ConfigurationPropertyOptions.None);
  68. autoEventWireupProp = new ConfigurationProperty ("autoEventWireup", typeof(bool), true);
  69. bufferProp = new ConfigurationProperty ("buffer", typeof(bool), false);
  70. controlsProp = new ConfigurationProperty ("controls", typeof(TagPrefixCollection), null,
  71. null, null, ConfigurationPropertyOptions.None);
  72. enableEventValidationProp = new ConfigurationProperty ("enableEventValidation", typeof (bool), true);
  73. enableSessionStateProp = new ConfigurationProperty ("enableSessionState", typeof (PagesEnableSessionState), PagesEnableSessionState.True);
  74. enableViewStateProp = new ConfigurationProperty ("enableViewState", typeof (bool), true);
  75. enableViewStateMacProp = new ConfigurationProperty ("enableViewStateMac", typeof (bool), true);
  76. maintainScrollPositionOnPostBackProp = new ConfigurationProperty ("maintainScrollPositionOnPostBack", typeof (bool), false);
  77. masterPageFileProp = new ConfigurationProperty ("masterPageFile", typeof (string), "");
  78. maxPageStateFieldLengthProp = new ConfigurationProperty ("maxPageStateFieldLength", typeof (int), -1);
  79. modeProp = new ConfigurationProperty ("compilationMode", typeof (CompilationMode), CompilationMode.Always,
  80. new GenericEnumConverter (typeof (CompilationMode)), PropertyHelper.DefaultValidator,
  81. ConfigurationPropertyOptions.None);
  82. namespacesProp = new ConfigurationProperty ("namespaces", typeof (NamespaceCollection), null,
  83. null, null, ConfigurationPropertyOptions.None);
  84. pageBaseTypeProp = new ConfigurationProperty ("pageBaseType", typeof (string), "System.Web.UI.Page");
  85. pageParserFilterTypeProp = new ConfigurationProperty ("pageParserFilterType", typeof (string), "");
  86. smartNavigationProp = new ConfigurationProperty ("smartNavigation", typeof (bool), false);
  87. styleSheetThemeProp = new ConfigurationProperty ("styleSheetTheme", typeof (string), "");
  88. tagMappingProp = new ConfigurationProperty ("tagMapping", typeof (TagMapCollection), null,
  89. null, null, ConfigurationPropertyOptions.None);
  90. themeProp = new ConfigurationProperty ("theme", typeof (string), "");
  91. userControlBaseTypeProp = new ConfigurationProperty ("userControlBaseType", typeof (string), "System.Web.UI.UserControl");
  92. validateRequestProp = new ConfigurationProperty ("validateRequest", typeof (bool), true);
  93. viewStateEncryptionModeProp = new ConfigurationProperty ("viewStateEncryptionMode", typeof (ViewStateEncryptionMode), ViewStateEncryptionMode.Auto,
  94. new GenericEnumConverter (typeof (ViewStateEncryptionMode)), PropertyHelper.DefaultValidator,
  95. ConfigurationPropertyOptions.None);
  96. properties = new ConfigurationPropertyCollection ();
  97. properties.Add (asyncTimeoutProp);
  98. properties.Add (autoEventWireupProp);
  99. properties.Add (bufferProp);
  100. properties.Add (controlsProp);
  101. properties.Add (enableEventValidationProp);
  102. properties.Add (enableSessionStateProp);
  103. properties.Add (enableViewStateProp);
  104. properties.Add (enableViewStateMacProp);
  105. properties.Add (maintainScrollPositionOnPostBackProp);
  106. properties.Add (masterPageFileProp);
  107. properties.Add (maxPageStateFieldLengthProp);
  108. properties.Add (modeProp);
  109. properties.Add (namespacesProp);
  110. properties.Add (pageBaseTypeProp);
  111. properties.Add (pageParserFilterTypeProp);
  112. properties.Add (smartNavigationProp);
  113. properties.Add (styleSheetThemeProp);
  114. properties.Add (tagMappingProp);
  115. properties.Add (themeProp);
  116. properties.Add (userControlBaseTypeProp);
  117. properties.Add (validateRequestProp);
  118. properties.Add (viewStateEncryptionModeProp);
  119. }
  120. public PagesSection ()
  121. {
  122. }
  123. [TimeSpanValidator (MinValueString = "00:00:00",
  124. MaxValueString = "10675199.02:48:05.4775807")]
  125. [TypeConverter (typeof (TimeSpanSecondsConverter))]
  126. [ConfigurationProperty ("asyncTimeout", DefaultValue = "00:00:45")]
  127. public TimeSpan AsyncTimeout {
  128. get { return (TimeSpan) base [asyncTimeoutProp]; }
  129. set { base [asyncTimeoutProp] = value; }
  130. }
  131. [ConfigurationProperty ("autoEventWireup", DefaultValue = "True")]
  132. public bool AutoEventWireup {
  133. get { return (bool) base [autoEventWireupProp]; }
  134. set { base [autoEventWireupProp] = value; }
  135. }
  136. [ConfigurationProperty ("buffer", DefaultValue = "True")]
  137. public bool Buffer {
  138. get { return (bool) base [bufferProp]; }
  139. set { base [bufferProp] = value; }
  140. }
  141. [ConfigurationProperty ("compilationMode", DefaultValue = "Always")]
  142. public CompilationMode CompilationMode {
  143. get { return (CompilationMode) base [modeProp]; }
  144. set { base [modeProp] = value; }
  145. }
  146. [ConfigurationProperty ("controls")]
  147. public TagPrefixCollection Controls {
  148. get { return (TagPrefixCollection) base[controlsProp]; }
  149. }
  150. [ConfigurationProperty ("enableEventValidation", DefaultValue = "True")]
  151. public bool EnableEventValidation {
  152. get { return (bool) base[enableEventValidationProp]; }
  153. set { base[enableEventValidationProp] = value; }
  154. }
  155. [ConfigurationProperty ("enableSessionState", DefaultValue = "true")]
  156. public PagesEnableSessionState EnableSessionState {
  157. get { return (PagesEnableSessionState) base[enableSessionStateProp]; }
  158. set { base[enableSessionStateProp] = value; }
  159. }
  160. [ConfigurationProperty ("enableViewState", DefaultValue = "True")]
  161. public bool EnableViewState {
  162. get { return (bool) base[enableViewStateProp]; }
  163. set { base[enableViewStateProp] = value; }
  164. }
  165. [ConfigurationProperty ("enableViewStateMac", DefaultValue = "True")]
  166. public bool EnableViewStateMac {
  167. get { return (bool) base[enableViewStateMacProp]; }
  168. set { base[enableViewStateMacProp] = value; }
  169. }
  170. [ConfigurationProperty ("maintainScrollPositionOnPostBack", DefaultValue = "False")]
  171. public bool MaintainScrollPositionOnPostBack {
  172. get { return (bool) base[maintainScrollPositionOnPostBackProp]; }
  173. set { base [maintainScrollPositionOnPostBackProp] = value; }
  174. }
  175. [ConfigurationProperty ("masterPageFile", DefaultValue = "")]
  176. public string MasterPageFile {
  177. get { return (string) base[masterPageFileProp]; }
  178. set { base[masterPageFileProp] = value; }
  179. }
  180. [ConfigurationProperty ("maxPageStateFieldLength", DefaultValue = "-1")]
  181. public int MaxPageStateFieldLength {
  182. get { return (int) base[maxPageStateFieldLengthProp]; }
  183. set { base[maxPageStateFieldLengthProp] = value; }
  184. }
  185. [ConfigurationProperty ("namespaces")]
  186. public NamespaceCollection Namespaces {
  187. get { return (NamespaceCollection) base[namespacesProp]; }
  188. }
  189. [ConfigurationProperty ("pageBaseType", DefaultValue = "System.Web.UI.Page")]
  190. public string PageBaseType {
  191. get { return (string) base[pageBaseTypeProp]; }
  192. set { base[pageBaseTypeProp] = value; }
  193. }
  194. [ConfigurationProperty ("pageParserFilterType", DefaultValue = "")]
  195. public string PageParserFilterType {
  196. get { return (string) base[pageParserFilterTypeProp]; }
  197. set { base [pageParserFilterTypeProp] = value; }
  198. }
  199. [ConfigurationProperty ("smartNavigation", DefaultValue = "False")]
  200. public bool SmartNavigation {
  201. get { return (bool) base[smartNavigationProp]; }
  202. set { base[smartNavigationProp] = value; }
  203. }
  204. [ConfigurationProperty ("styleSheetTheme", DefaultValue = "")]
  205. public string StyleSheetTheme {
  206. get { return (string) base[styleSheetThemeProp]; }
  207. set { base[styleSheetThemeProp] = value; }
  208. }
  209. [ConfigurationProperty ("tagMapping")]
  210. public TagMapCollection TagMapping {
  211. get { return (TagMapCollection) base [tagMappingProp]; }
  212. }
  213. [ConfigurationProperty ("theme", DefaultValue = "")]
  214. public string Theme {
  215. get { return (string) base[themeProp]; }
  216. set { base[themeProp] = value; }
  217. }
  218. [ConfigurationProperty ("userControlBaseType", DefaultValue = "System.Web.UI.UserControl")]
  219. public string UserControlBaseType {
  220. get { return (string) base[userControlBaseTypeProp]; }
  221. set { base[userControlBaseTypeProp] = value; }
  222. }
  223. [ConfigurationProperty ("validateRequest", DefaultValue = "True")]
  224. public bool ValidateRequest {
  225. get { return (bool) base[validateRequestProp]; }
  226. set { base[validateRequestProp] = value; }
  227. }
  228. [ConfigurationProperty ("viewStateEncryptionMode", DefaultValue = "Auto")]
  229. public ViewStateEncryptionMode ViewStateEncryptionMode {
  230. get { return (ViewStateEncryptionMode) base [viewStateEncryptionModeProp]; }
  231. set { base [viewStateEncryptionModeProp] = value; }
  232. }
  233. protected override ConfigurationPropertyCollection Properties {
  234. get { return properties; }
  235. }
  236. [MonoTODO]
  237. protected override void DeserializeSection (XmlReader reader)
  238. {
  239. base.DeserializeSection (reader);
  240. /* XXX more here?.. */
  241. }
  242. }
  243. }
  244. #endif