internal override bool ProcessMainDirectiveAttribute(string deviceName, string name, string value, IDictionary parseData) { switch (name) { case "errorpage": this._errorPage = System.Web.UI.Util.GetNonEmptyAttribute(name, value); return(false); case "contenttype": System.Web.UI.Util.GetNonEmptyAttribute(name, value); return(false); case "theme": if (!base.IsExpressionBuilderValue(value)) { System.Web.UI.Util.CheckThemeAttribute(value); return(false); } return(false); case "stylesheettheme": base.ValidateBuiltInAttribute(deviceName, name, value); System.Web.UI.Util.CheckThemeAttribute(value); this._styleSheetTheme = value; return(true); case "enablesessionstate": this.flags[0x100000] = true; this.flags[0x200000] = false; if (!System.Web.UI.Util.IsFalseString(value)) { if (StringUtil.EqualsIgnoreCase(value, "readonly")) { this.flags[0x200000] = true; } else if (!System.Web.UI.Util.IsTrueString(value)) { base.ProcessError(System.Web.SR.GetString("Enablesessionstate_must_be_true_false_or_readonly")); } break; } this.flags[0x100000] = false; break; case "culture": this._culture = System.Web.UI.Util.GetNonEmptyAttribute(name, value); if (!HttpRuntime.HasAspNetHostingPermission(AspNetHostingPermissionLevel.Medium)) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "culture" })); } if (!StringUtil.EqualsIgnoreCase(value, HttpApplication.AutoCulture)) { CultureInfo info; try { if (StringUtil.StringStartsWithIgnoreCase(value, HttpApplication.AutoCulture)) { this._culture = this._culture.Substring(5); } info = HttpServerUtility.CreateReadOnlyCultureInfo(this._culture); } catch { base.ProcessError(System.Web.SR.GetString("Invalid_attribute_value", new object[] { this._culture, "culture" })); return(false); } if (info.IsNeutralCulture) { base.ProcessError(System.Web.SR.GetString("Invalid_culture_attribute", new object[] { System.Web.UI.Util.GetSpecificCulturesFormattedList(info) })); } } return(false); case "lcid": if (!base.IsExpressionBuilderValue(value)) { this._lcid = System.Web.UI.Util.GetNonNegativeIntegerAttribute(name, value); try { HttpServerUtility.CreateReadOnlyCultureInfo(this._lcid); } catch { base.ProcessError(System.Web.SR.GetString("Invalid_attribute_value", new object[] { this._lcid.ToString(CultureInfo.InvariantCulture), "lcid" })); } return(false); } return(false); case "uiculture": System.Web.UI.Util.GetNonEmptyAttribute(name, value); return(false); case "responseencoding": if (!base.IsExpressionBuilderValue(value)) { this._responseEncoding = System.Web.UI.Util.GetNonEmptyAttribute(name, value); Encoding.GetEncoding(this._responseEncoding); return(false); } return(false); case "codepage": if (!base.IsExpressionBuilderValue(value)) { this._codePage = System.Web.UI.Util.GetNonNegativeIntegerAttribute(name, value); Encoding.GetEncoding(this._codePage); return(false); } return(false); case "transaction": base.OnFoundAttributeRequiringCompilation(name); this.ParseTransactionAttribute(name, value); goto Label_05CF; case "aspcompat": base.OnFoundAttributeRequiringCompilation(name); this.flags[0x40] = System.Web.UI.Util.GetBooleanAttribute(name, value); if (this.flags[0x40] && !HttpRuntime.HasUnmanagedPermission()) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "AspCompat" })); } goto Label_05CF; case "async": base.OnFoundAttributeRequiringCompilation(name); this.flags[0x800000] = System.Web.UI.Util.GetBooleanAttribute(name, value); if (!HttpRuntime.HasAspNetHostingPermission(AspNetHostingPermissionLevel.Medium)) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "async" })); } goto Label_05CF; case "tracemode": { object obj2 = System.Web.UI.Util.GetEnumAttribute(name, value, typeof(TraceModeInternal)); this._traceMode = (System.Web.TraceMode)obj2; goto Label_05CF; } case "trace": if (!System.Web.UI.Util.GetBooleanAttribute(name, value)) { this._traceEnabled = TraceEnable.Disable; } else { this._traceEnabled = TraceEnable.Enable; } goto Label_05CF; case "smartnavigation": base.ValidateBuiltInAttribute(deviceName, name, value); return(!System.Web.UI.Util.GetBooleanAttribute(name, value)); case "maintainscrollpositiononpostback": return(!System.Web.UI.Util.GetBooleanAttribute(name, value)); case "validaterequest": this.flags[0x400000] = System.Web.UI.Util.GetBooleanAttribute(name, value); goto Label_05CF; case "clienttarget": if (!base.IsExpressionBuilderValue(value)) { HttpCapabilitiesDefaultProvider.GetUserAgentFromClientTarget(base.CurrentVirtualPath, value); return(false); } return(false); case "masterpagefile": if (!base.IsExpressionBuilderValue(value)) { if (value.Length > 0) { Type referencedType = base.GetReferencedType(value); if (!typeof(MasterPage).IsAssignableFrom(referencedType)) { base.ProcessError(System.Web.SR.GetString("Invalid_master_base", new object[] { value })); } if (deviceName.Length > 0) { this.EnsureMasterPageFileFromConfigApplied(); } } this._mainDirectiveMasterPageSet = true; return(false); } return(false); default: return(base.ProcessMainDirectiveAttribute(deviceName, name, value, parseData)); } if (this.flags[0x100000]) { base.OnFoundAttributeRequiringCompilation(name); } Label_05CF: base.ValidateBuiltInAttribute(deviceName, name, value); return(true); }
internal override bool ProcessMainDirectiveAttribute(string deviceName, string name, string value, IDictionary parseData) { switch (name) { case "errorpage": this._errorPage = System.Web.UI.Util.GetNonEmptyAttribute(name, value); return false; case "contenttype": System.Web.UI.Util.GetNonEmptyAttribute(name, value); return false; case "theme": if (!base.IsExpressionBuilderValue(value)) { System.Web.UI.Util.CheckThemeAttribute(value); return false; } return false; case "stylesheettheme": base.ValidateBuiltInAttribute(deviceName, name, value); System.Web.UI.Util.CheckThemeAttribute(value); this._styleSheetTheme = value; return true; case "enablesessionstate": this.flags[0x100000] = true; this.flags[0x200000] = false; if (!System.Web.UI.Util.IsFalseString(value)) { if (StringUtil.EqualsIgnoreCase(value, "readonly")) { this.flags[0x200000] = true; } else if (!System.Web.UI.Util.IsTrueString(value)) { base.ProcessError(System.Web.SR.GetString("Enablesessionstate_must_be_true_false_or_readonly")); } break; } this.flags[0x100000] = false; break; case "culture": this._culture = System.Web.UI.Util.GetNonEmptyAttribute(name, value); if (!HttpRuntime.HasAspNetHostingPermission(AspNetHostingPermissionLevel.Medium)) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "culture" })); } if (!StringUtil.EqualsIgnoreCase(value, HttpApplication.AutoCulture)) { CultureInfo info; try { if (StringUtil.StringStartsWithIgnoreCase(value, HttpApplication.AutoCulture)) { this._culture = this._culture.Substring(5); } info = HttpServerUtility.CreateReadOnlyCultureInfo(this._culture); } catch { base.ProcessError(System.Web.SR.GetString("Invalid_attribute_value", new object[] { this._culture, "culture" })); return false; } if (info.IsNeutralCulture) { base.ProcessError(System.Web.SR.GetString("Invalid_culture_attribute", new object[] { System.Web.UI.Util.GetSpecificCulturesFormattedList(info) })); } } return false; case "lcid": if (!base.IsExpressionBuilderValue(value)) { this._lcid = System.Web.UI.Util.GetNonNegativeIntegerAttribute(name, value); try { HttpServerUtility.CreateReadOnlyCultureInfo(this._lcid); } catch { base.ProcessError(System.Web.SR.GetString("Invalid_attribute_value", new object[] { this._lcid.ToString(CultureInfo.InvariantCulture), "lcid" })); } return false; } return false; case "uiculture": System.Web.UI.Util.GetNonEmptyAttribute(name, value); return false; case "responseencoding": if (!base.IsExpressionBuilderValue(value)) { this._responseEncoding = System.Web.UI.Util.GetNonEmptyAttribute(name, value); Encoding.GetEncoding(this._responseEncoding); return false; } return false; case "codepage": if (!base.IsExpressionBuilderValue(value)) { this._codePage = System.Web.UI.Util.GetNonNegativeIntegerAttribute(name, value); Encoding.GetEncoding(this._codePage); return false; } return false; case "transaction": base.OnFoundAttributeRequiringCompilation(name); this.ParseTransactionAttribute(name, value); goto Label_05CF; case "aspcompat": base.OnFoundAttributeRequiringCompilation(name); this.flags[0x40] = System.Web.UI.Util.GetBooleanAttribute(name, value); if (this.flags[0x40] && !HttpRuntime.HasUnmanagedPermission()) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "AspCompat" })); } goto Label_05CF; case "async": base.OnFoundAttributeRequiringCompilation(name); this.flags[0x800000] = System.Web.UI.Util.GetBooleanAttribute(name, value); if (!HttpRuntime.HasAspNetHostingPermission(AspNetHostingPermissionLevel.Medium)) { throw new HttpException(System.Web.SR.GetString("Insufficient_trust_for_attribute", new object[] { "async" })); } goto Label_05CF; case "tracemode": { object obj2 = System.Web.UI.Util.GetEnumAttribute(name, value, typeof(TraceModeInternal)); this._traceMode = (System.Web.TraceMode) obj2; goto Label_05CF; } case "trace": if (!System.Web.UI.Util.GetBooleanAttribute(name, value)) { this._traceEnabled = TraceEnable.Disable; } else { this._traceEnabled = TraceEnable.Enable; } goto Label_05CF; case "smartnavigation": base.ValidateBuiltInAttribute(deviceName, name, value); return !System.Web.UI.Util.GetBooleanAttribute(name, value); case "maintainscrollpositiononpostback": return !System.Web.UI.Util.GetBooleanAttribute(name, value); case "validaterequest": this.flags[0x400000] = System.Web.UI.Util.GetBooleanAttribute(name, value); goto Label_05CF; case "clienttarget": if (!base.IsExpressionBuilderValue(value)) { HttpCapabilitiesDefaultProvider.GetUserAgentFromClientTarget(base.CurrentVirtualPath, value); return false; } return false; case "masterpagefile": if (!base.IsExpressionBuilderValue(value)) { if (value.Length > 0) { Type referencedType = base.GetReferencedType(value); if (!typeof(MasterPage).IsAssignableFrom(referencedType)) { base.ProcessError(System.Web.SR.GetString("Invalid_master_base", new object[] { value })); } if (deviceName.Length > 0) { this.EnsureMasterPageFileFromConfigApplied(); } } this._mainDirectiveMasterPageSet = true; return false; } return false; default: return base.ProcessMainDirectiveAttribute(deviceName, name, value, parseData); } if (this.flags[0x100000]) { base.OnFoundAttributeRequiringCompilation(name); } Label_05CF: base.ValidateBuiltInAttribute(deviceName, name, value); return true; }