PagesSection.cs 11 KB

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