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