[System.Web] Public event handlers from reference source
[mono.git] / mcs / class / System.Web / System.Web.UI / PageParser.cs
1 //      
2 // System.Web.UI.PageParser
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //
7 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
8 // Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
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
30 using System.Collections;
31 using System.Collections.Specialized;
32 using System.Globalization;
33 using System.Security.Permissions;
34 using System.Text;
35 using System.Web.Compilation;
36 using System.Web.Configuration;
37 using System.Web.Hosting;
38 using System.Web.Util;
39 using System.IO;
40
41 namespace System.Web.UI
42 {
43         // CAS - no InheritanceDemand here as the class is sealed
44         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
45         public sealed class PageParser : TemplateControlParser
46         {
47                 static Type defaultPageBaseType;
48                 static Type defaultApplicationBaseType;
49                 static Type defaultPageParserFilterType;
50                 static Type defaultUserControlBaseType;
51                 static bool enableLongStringsAsResources = true;
52                 PagesEnableSessionState enableSessionState = PagesEnableSessionState.True;
53                 bool enableViewStateMac;
54                 bool enableViewStateMacSet;
55                 bool smartNavigation;
56                 bool haveTrace;
57                 bool trace;
58                 bool notBuffer;
59                 TraceMode tracemode = TraceMode.Default;
60                 string contentType;
61                 MainDirectiveAttribute <int> codepage;
62                 MainDirectiveAttribute <string> responseEncoding;
63                 MainDirectiveAttribute <int> lcid;
64                 MainDirectiveAttribute <string> clientTarget;
65                 MainDirectiveAttribute <string> masterPage;
66                 MainDirectiveAttribute <string> title;
67                 MainDirectiveAttribute <string> theme;
68                 MainDirectiveAttribute <string> metaDescription;
69                 MainDirectiveAttribute <string> metaKeywords;
70                 string culture;
71                 string uiculture;
72                 string errorPage;
73                 bool validateRequest;
74                 bool async;
75                 int asyncTimeout = -1;
76                 Type masterType;
77                 string masterVirtualPath;
78                 string styleSheetTheme;
79                 bool enable_event_validation;
80                 bool maintainScrollPositionOnPostBack;
81                 int maxPageStateFieldLength = -1;
82                 Type previousPageType;
83                 string previousPageVirtualPath;
84                 public static bool EnableLongStringsAsResources {
85                         get { return enableLongStringsAsResources; }
86                         set {
87                                 BuildManager.AssertPreStartMethodsRunning ();
88                                 enableLongStringsAsResources = value;
89                         }
90                 }
91                 
92                 public static Type DefaultPageBaseType {
93                         get { return defaultPageBaseType; }
94                         set {
95                                 BuildManager.AssertPreStartMethodsRunning ();
96                                 if (value != null && !typeof (Page).IsAssignableFrom (value))
97                                         throw new ArgumentException (String.Format ("The value assigned to property '{0}' is invalid.", "DefaultPageBaseType"));
98                                 
99                                 defaultPageBaseType = value;
100                         }
101                 }
102
103                 public static Type DefaultApplicationBaseType {
104                         get { return defaultApplicationBaseType; }
105                         set {
106                                 BuildManager.AssertPreStartMethodsRunning ();
107                                 if (value != null && !typeof (HttpApplication).IsAssignableFrom (value))
108                                         throw new ArgumentException (String.Format ("The value assigned to property '{0}' is invalid.", "DefaultApplicationBaseType"));
109                                 defaultApplicationBaseType = value;
110                         }
111                 }
112
113                 public static Type DefaultPageParserFilterType {
114                         get { return defaultPageParserFilterType; }
115                         set {
116                                 BuildManager.AssertPreStartMethodsRunning ();
117                                 if (value != null && !typeof (PageParserFilter).IsAssignableFrom (value))
118                                         throw new ArgumentException (String.Format ("The value assigned to property '{0}' is invalid.", "DefaultPageParserFilterType"));
119                                 defaultPageParserFilterType = value;
120                         }
121                 }
122
123                 public static Type DefaultUserControlBaseType {
124                         get { return defaultUserControlBaseType; }
125                         set {
126                                 if (value != null && !typeof (UserControl).IsAssignableFrom (value))
127                                         throw new ArgumentException (String.Format ("The value assigned to property '{0}' is invalid.", "DefaultUserControlBaseType"));
128                                 BuildManager.AssertPreStartMethodsRunning ();
129                                 defaultUserControlBaseType = value;
130                         }
131                 }
132                 public PageParser ()
133                 {
134                         LoadConfigDefaults ();
135                 }
136                 
137                 internal PageParser (string virtualPath, string inputFile, HttpContext context)
138                 {
139                         this.VirtualPath = new VirtualPath (virtualPath);
140                         Context = context;
141                         BaseVirtualDir = VirtualPathUtility.GetDirectory (virtualPath, false);
142                         InputFile = inputFile;
143                         SetBaseType (null);
144                         AddApplicationAssembly ();
145                         LoadConfigDefaults ();
146                 }
147
148                 internal PageParser (VirtualPath virtualPath, TextReader reader, HttpContext context)
149                         : this (virtualPath, null, reader, context)
150                 {
151                 }
152                 
153                 internal PageParser (VirtualPath virtualPath, string inputFile, TextReader reader, HttpContext context)
154                 {
155                         this.VirtualPath = virtualPath;
156                         Context = context;
157                         BaseVirtualDir = virtualPath.DirectoryNoNormalize;
158                         Reader = reader;
159                         if (String.IsNullOrEmpty (inputFile))
160                                 InputFile = virtualPath.PhysicalPath;
161                         else
162                                 InputFile = inputFile;
163                         SetBaseType (null);
164                         AddApplicationAssembly ();
165                         LoadConfigDefaults ();
166                 }
167
168                 internal override void LoadConfigDefaults ()
169                 {
170                         base.LoadConfigDefaults ();
171                         PagesSection ps = PagesConfig;
172
173                         notBuffer = !ps.Buffer;
174                         enableSessionState = ps.EnableSessionState;
175                         enableViewStateMac = ps.EnableViewStateMac;
176                         smartNavigation = ps.SmartNavigation;
177                         validateRequest = ps.ValidateRequest;
178
179                         string value = ps.MasterPageFile;
180                         if (value.Length > 0)
181                                 masterPage = new MainDirectiveAttribute <string> (value, true);
182                         
183                         enable_event_validation = ps.EnableEventValidation;
184                         maxPageStateFieldLength = ps.MaxPageStateFieldLength;
185                         value = ps.Theme;
186                         if (value.Length > 0)
187                                 theme = new MainDirectiveAttribute <string> (value, true);
188                         
189                         styleSheetTheme = ps.StyleSheetTheme;
190                         if (styleSheetTheme.Length == 0)
191                                 styleSheetTheme = null;
192                         maintainScrollPositionOnPostBack = ps.MaintainScrollPositionOnPostBack;
193                 }
194                 
195                 public static IHttpHandler GetCompiledPageInstance (string virtualPath, string inputFile, HttpContext context)
196                 {
197                         bool isFake = false;
198
199                         if (!String.IsNullOrEmpty (inputFile))
200                                 isFake = !inputFile.StartsWith (HttpRuntime.AppDomainAppPath);
201                         
202                         return BuildManager.CreateInstanceFromVirtualPath (new VirtualPath (virtualPath, inputFile, isFake), typeof (IHttpHandler)) as IHttpHandler;
203                 }
204
205                 internal override void ProcessMainAttributes (IDictionary atts)
206                 {
207                         // note: the 'enableSessionState' configuration property is
208                         // processed in a case-sensitive manner while the page-level
209                         // attribute is processed case-insensitive
210                         string enabless = GetString (atts, "EnableSessionState", null);
211                         if (enabless != null) {
212                                 if (String.Compare (enabless, "readonly", true, Helpers.InvariantCulture) == 0)
213                                         enableSessionState = PagesEnableSessionState.ReadOnly;
214                                 else if (String.Compare (enabless, "true", true, Helpers.InvariantCulture) == 0)
215                                         enableSessionState = PagesEnableSessionState.True;
216                                 else if (String.Compare (enabless, "false", true, Helpers.InvariantCulture) == 0)
217                                         enableSessionState = PagesEnableSessionState.False;
218                                 else
219                                         ThrowParseException ("Invalid value for enableSessionState: " + enabless);
220                         }
221
222                         string value = GetString (atts, "CodePage", null);
223                         if (value != null) {
224                                 if (responseEncoding != null)
225                                         ThrowParseException ("CodePage and ResponseEncoding are mutually exclusive.");
226                                 
227                                 if (!BaseParser.IsExpression (value)) {
228                                         int cpval = -1;
229
230                                         try {
231                                                 cpval = (int) UInt32.Parse (value);
232                                         } catch {
233                                                 ThrowParseException ("Invalid value for CodePage: " + value);
234                                         }
235
236                                         try {
237                                                 Encoding.GetEncoding (cpval);
238                                         } catch {
239                                                 ThrowParseException ("Unsupported codepage: " + value);
240                                         }
241                                         codepage = new MainDirectiveAttribute <int> (cpval, true);
242                                 } else
243                                         codepage = new MainDirectiveAttribute <int> (value);
244                         }
245                         
246                         value = GetString (atts, "ResponseEncoding", null);
247                         if (value != null) {
248                                 if (codepage != null)
249                                         ThrowParseException ("CodePage and ResponseEncoding are mutually exclusive.");
250
251                                 if (!BaseParser.IsExpression (value)) {
252                                         try {
253                                                 Encoding.GetEncoding (value);
254                                         } catch {
255                                                 ThrowParseException ("Unsupported encoding: " + value);
256                                         }
257                                         responseEncoding = new MainDirectiveAttribute <string> (value, true);
258                                 } else
259                                         responseEncoding = new MainDirectiveAttribute <string> (value);
260                         }
261                         
262                         contentType = GetString (atts, "ContentType", null);
263
264                         value = GetString (atts, "LCID", null);
265                         if (value != null) {
266                                 if (!BaseParser.IsExpression (value)) {
267                                         int parsedLcid = -1;
268                                         try {
269                                                 parsedLcid = (int) UInt32.Parse (value);
270                                         } catch {
271                                                 ThrowParseException ("Invalid value for LCID: " + value);
272                                         }
273
274                                         CultureInfo ci = null;
275                                         try {
276                                                 ci = new CultureInfo (parsedLcid);
277                                         } catch {
278                                                 ThrowParseException ("Unsupported LCID: " + value);
279                                         }
280
281                                         if (ci.IsNeutralCulture) {
282                                                 string suggestedCulture = SuggestCulture (ci.Name);
283                                                 string fmt = "LCID attribute must be set to a non-neutral Culture.";
284                                                 if (suggestedCulture != null) {
285                                                         ThrowParseException (fmt + " Please try one of these: " +
286                                                                              suggestedCulture);
287                                                 } else {
288                                                         ThrowParseException (fmt);
289                                                 }
290                                         }
291                                         lcid = new MainDirectiveAttribute <int> (parsedLcid, true);
292                                 } else
293                                         lcid = new MainDirectiveAttribute <int> (value);
294                         }
295
296                         culture = GetString (atts, "Culture", null);
297                         if (culture != null) {
298                                 if (lcid != null) 
299                                         ThrowParseException ("Culture and LCID are mutually exclusive.");
300                                 
301                                 CultureInfo ci = null;
302                                 try {
303                                         if (!culture.StartsWith ("auto"))
304                                                 ci = new CultureInfo (culture);
305                                 } catch {
306                                         ThrowParseException ("Unsupported Culture: " + culture);
307                                 }
308
309                                 if (ci != null && ci.IsNeutralCulture) {
310                                         string suggestedCulture = SuggestCulture (culture);
311                                         string fmt = "Culture attribute must be set to a non-neutral Culture.";
312                                         if (suggestedCulture != null)
313                                                 ThrowParseException (fmt +
314                                                                 " Please try one of these: " + suggestedCulture);
315                                         else
316                                                 ThrowParseException (fmt);
317                                 }
318                         }
319
320                         uiculture = GetString (atts, "UICulture", null);
321                         if (uiculture != null) {
322                                 CultureInfo ci = null;
323                                 try {
324                                         if (!uiculture.StartsWith ("auto"))
325                                                 ci = new CultureInfo (uiculture);
326                                 } catch {
327                                         ThrowParseException ("Unsupported Culture: " + uiculture);
328                                 }
329
330                                 if (ci != null && ci.IsNeutralCulture) {
331                                         string suggestedCulture = SuggestCulture (uiculture);
332                                         string fmt = "UICulture attribute must be set to a non-neutral Culture.";
333                                         if (suggestedCulture != null)
334                                                 ThrowParseException (fmt +
335                                                                 " Please try one of these: " + suggestedCulture);
336                                         else
337                                                 ThrowParseException (fmt);
338                                 }
339                         }
340
341                         string tracestr = GetString (atts, "Trace", null);
342                         if (tracestr != null) {
343                                 haveTrace = true;
344                                 atts ["Trace"] = tracestr;
345                                 trace = GetBool (atts, "Trace", false);
346                         }
347
348                         string tracemodes = GetString (atts, "TraceMode", null);
349                         if (tracemodes != null) {
350                                 bool valid = true;
351                                 try {
352                                         tracemode = (TraceMode) Enum.Parse (typeof (TraceMode), tracemodes, false);
353                                 } catch {
354                                         valid = false;
355                                 }
356
357                                 if (!valid || tracemode == TraceMode.Default)
358                                         ThrowParseException ("The 'tracemode' attribute is case sensitive and must be " +
359                                                         "one of the following values: SortByTime, SortByCategory.");
360                         }
361
362                         errorPage = GetString (atts, "ErrorPage", null);
363                         validateRequest = GetBool (atts, "ValidateRequest", validateRequest);
364                         value = GetString (atts, "ClientTarget", null);
365                         if (value != null) {                            
366                                 if (!BaseParser.IsExpression (value)) {
367                                         value = value.Trim ();
368                                         
369                                         ClientTargetSection sec = GetConfigSection <ClientTargetSection> ("system.web/clientTarget");
370                                         ClientTarget ct = null;
371                                 
372                                         if ((ct = sec.ClientTargets [value]) == null)
373                                                 value = value.ToLowerInvariant ();
374                                 
375                                         if (ct == null && (ct = sec.ClientTargets [value]) == null) {
376                                                 ThrowParseException (String.Format (
377                                                                              "ClientTarget '{0}' is an invalid alias. See the " +
378                                                                              "documentation for <clientTarget> config. section.",
379                                                                              clientTarget));
380                                         }
381                                         value = ct.UserAgent;
382                                         clientTarget = new MainDirectiveAttribute <string> (value, true);
383                                 } else
384                                         clientTarget = new MainDirectiveAttribute <string> (value);
385                         }
386
387                         notBuffer = !GetBool (atts, "Buffer", true);
388                         async = GetBool (atts, "Async", false);
389                         string asyncTimeoutVal = GetString (atts, "AsyncTimeout", null);
390                         if (asyncTimeoutVal != null) {
391                                 try {
392                                         asyncTimeout = Int32.Parse (asyncTimeoutVal);
393                                 } catch (Exception) {
394                                         ThrowParseException ("AsyncTimeout must be an integer value");
395                                 }
396                         }
397                         
398                         value = GetString (atts, "MasterPageFile", masterPage != null ? masterPage.Value : null);
399                         if (!String.IsNullOrEmpty (value)) {
400                                 if (!BaseParser.IsExpression (value)) {
401                                         value = System.Web.VirtualPathUtility.Combine(BaseVirtualDir, value);
402                                         var vpp = HostingEnvironment.VirtualPathProvider;
403                                         if (!vpp.FileExists (value))
404                                                 ThrowParseFileNotFound (value);
405                                         value = vpp.CombineVirtualPaths (VirtualPath.Absolute, VirtualPathUtility.ToAbsolute (value));
406                                         AddDependency (value, false);
407                                         masterPage = new MainDirectiveAttribute <string> (value, true);
408                                 } else
409                                         masterPage = new MainDirectiveAttribute <string> (value);
410                         }
411                         
412                         value = GetString(atts, "Title", null);
413                         if (value != null) {
414                                 if (!BaseParser.IsExpression (value))
415                                         title = new MainDirectiveAttribute <string> (value, true);
416                                 else
417                                         title = new MainDirectiveAttribute <string> (value);
418                         }
419                         
420                         value = GetString (atts, "Theme", theme != null ? theme.Value : null);
421                         if (value != null) {
422                                 if (!BaseParser.IsExpression (value))
423                                         theme = new MainDirectiveAttribute <string> (value, true);
424                                 else
425                                         theme = new MainDirectiveAttribute <string> (value);
426                         }
427                         
428                         styleSheetTheme = GetString (atts, "StyleSheetTheme", styleSheetTheme);
429                         enable_event_validation = GetBool (atts, "EnableEventValidation", enable_event_validation);
430                         maintainScrollPositionOnPostBack = GetBool (atts, "MaintainScrollPositionOnPostBack", maintainScrollPositionOnPostBack);
431
432                         if (atts.Contains ("EnableViewStateMac")) {
433                                 enableViewStateMac = GetBool (atts, "EnableViewStateMac", enableViewStateMac);
434                                 enableViewStateMacSet = true;
435                         }
436                         value = GetString (atts, "MetaDescription", null);
437                         if (value != null) {
438                                 if (!BaseParser.IsExpression (value))
439                                         metaDescription = new MainDirectiveAttribute <string> (value, true);
440                                 else
441                                         metaDescription = new MainDirectiveAttribute <string> (value);
442                         }
443
444                         value = GetString (atts, "MetaKeywords", null);
445                         if (value != null) {
446                                 if (!BaseParser.IsExpression (value))
447                                         metaKeywords = new MainDirectiveAttribute <string> (value, true);
448                                 else
449                                         metaKeywords = new MainDirectiveAttribute <string> (value);
450                         }
451                         // Ignored by now
452                         GetString (atts, "SmartNavigation", null);
453
454                         base.ProcessMainAttributes (atts);
455                 }
456                 
457                 internal override void AddDirective (string directive, IDictionary atts)
458                 {
459                         bool isMasterType = String.Compare ("MasterType", directive, StringComparison.OrdinalIgnoreCase) == 0;
460                         bool isPreviousPageType = isMasterType ? false : String.Compare ("PreviousPageType", directive,
461                                                                                          StringComparison.OrdinalIgnoreCase) == 0;
462
463                         string typeName = null;
464                         string virtualPath = null;
465                         Type type = null;
466                         
467                         if (isMasterType || isPreviousPageType) {
468                                 PageParserFilter pfilter = PageParserFilter;
469                                 if (pfilter != null)
470                                         pfilter.PreprocessDirective (directive.ToLowerInvariant (), atts);
471                                 
472                                 typeName = GetString (atts, "TypeName", null);
473                                 virtualPath = GetString (atts, "VirtualPath", null);
474
475                                 if (typeName != null && virtualPath != null)
476                                         ThrowParseException (
477                                                 String.Format ("The '{0}' directive must have exactly one attribute: TypeName or VirtualPath", directive));
478                                 if (typeName != null) {
479                                         type = LoadType (typeName);
480                                         if (type == null)
481                                                 ThrowParseException (String.Format ("Could not load type '{0}'.", typeName));
482                                         if (isMasterType)
483                                                 masterType = type;
484                                         else
485                                                 previousPageType = type;
486                                 } else if (!String.IsNullOrEmpty (virtualPath)) {
487                                         if (!HostingEnvironment.VirtualPathProvider.FileExists (virtualPath))
488                                                 ThrowParseFileNotFound (virtualPath);
489
490                                         AddDependency (virtualPath, true);
491                                         if (isMasterType)
492                                                 masterVirtualPath = virtualPath;
493                                         else
494                                                 previousPageVirtualPath = virtualPath;
495                                 } else
496                                         ThrowParseException (String.Format ("The {0} directive must have either a TypeName or a VirtualPath attribute.", directive));
497
498                                 if (type != null)
499                                         AddAssembly (type.Assembly, true);
500                         } else
501                                 base.AddDirective (directive, atts);
502                 }
503                 
504                 static string SuggestCulture (string culture)
505                 {
506                         string retval = null;
507                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.SpecificCultures)) {
508                                 if (ci.Name.StartsWith (culture))
509                                         retval += ci.Name + " ";
510                         }
511                         return retval;
512                 }
513
514                 internal Type GetCompiledPageType (string virtualPath, string inputFile, HttpContext context)
515                 {
516                         return BuildManager.GetCompiledType (virtualPath);
517                 }
518                 
519                 internal override Type CompileIntoType ()
520                 {
521                         AspGenerator generator = new AspGenerator (this);
522                         return generator.GetCompiledType ();
523                 }
524
525                 internal bool EnableSessionState {
526                         get {
527                                 return enableSessionState == PagesEnableSessionState.True ||
528                                         ReadOnlySessionState;
529                         }
530                 }
531
532                 internal bool EnableViewStateMac {
533                         get { return enableViewStateMac; }
534                 }
535
536                 internal bool EnableViewStateMacSet {
537                         get { return enableViewStateMacSet; }
538                 }
539                 
540                 internal bool SmartNavigation {
541                         get { return smartNavigation; }
542                 }
543                 
544                 internal bool ReadOnlySessionState {
545                         get {
546                                 return enableSessionState == PagesEnableSessionState.ReadOnly;
547                         }
548                 }
549
550                 internal bool HaveTrace {
551                         get { return haveTrace; }
552                 }
553
554                 internal bool Trace {
555                         get { return trace; }
556                 }
557
558                 internal TraceMode TraceMode {
559                         get { return tracemode; }
560                 }               
561                 internal override Type DefaultBaseType {
562                         get {
563                                 Type ret = DefaultPageBaseType;
564                                 if (ret == null)
565                                         return base.DefaultBaseType;
566
567                                 return ret;
568                         }
569                 }
570                 internal override string DefaultBaseTypeName {
571                         get { return PagesConfig.PageBaseType; }
572                 }
573                 
574                 internal override string DefaultDirectiveName {
575                         get { return "page"; }
576                 }
577
578                 internal string ContentType {
579                         get { return contentType; }
580                 }
581
582                 internal MainDirectiveAttribute <string> ResponseEncoding {
583                         get { return responseEncoding; }
584                 }
585                 
586                 internal MainDirectiveAttribute <int> CodePage {
587                         get { return codepage; }
588                 }
589
590                 internal MainDirectiveAttribute <int> LCID {
591                         get { return lcid; }
592                 }
593
594                 internal MainDirectiveAttribute <string> ClientTarget {
595                         get { return clientTarget; }
596                 }
597
598                 internal MainDirectiveAttribute <string> MasterPageFile {
599                         get { return masterPage; }
600                 }
601
602                 internal MainDirectiveAttribute <string> Title {
603                         get { return title; }
604                 }
605
606                 internal MainDirectiveAttribute <string> Theme {
607                         get { return theme; }
608                 }
609                 internal MainDirectiveAttribute <string> MetaDescription {
610                         get { return metaDescription; }
611                 }
612
613                 internal MainDirectiveAttribute <string> MetaKeywords {
614                         get { return metaKeywords; }
615                 }
616                 internal string Culture {
617                         get { return culture; }
618                 }
619
620                 internal string UICulture {
621                         get { return uiculture; }
622                 }
623
624                 internal string ErrorPage {
625                         get { return errorPage; }
626                 }
627
628                 internal bool ValidateRequest {
629                         get { return validateRequest; }
630                 }
631
632                 internal bool NotBuffer {
633                         get { return notBuffer; }
634                 }
635
636                 internal bool Async {
637                         get { return async; }
638                 }
639
640                 internal int AsyncTimeout {
641                         get { return asyncTimeout; }
642                 }
643
644                 internal string StyleSheetTheme {
645                         get { return styleSheetTheme; }
646                 }
647                 
648                 internal Type MasterType {
649                         get {
650                                 if (masterType == null && !String.IsNullOrEmpty (masterVirtualPath))
651                                         masterType = BuildManager.GetCompiledType (masterVirtualPath);
652                                 
653                                 return masterType;
654                         }
655                 }
656
657                 internal bool EnableEventValidation {
658                         get { return enable_event_validation; }
659                 }
660
661                 internal bool MaintainScrollPositionOnPostBack {
662                         get { return maintainScrollPositionOnPostBack; }
663                 }
664
665                 internal int MaxPageStateFieldLength {
666                         get { return maxPageStateFieldLength; }
667                 }
668
669                 internal Type PreviousPageType {
670                         get {
671                                 if (previousPageType == null && !String.IsNullOrEmpty (previousPageVirtualPath)) {
672                                         string mappedPath = MapPath (previousPageVirtualPath);
673                                         previousPageType = GetCompiledPageType (previousPageVirtualPath, mappedPath, HttpContext.Current);
674                                 }
675                                 
676                                 return previousPageType;
677                         }
678                 }
679         }
680 }
681