public override void FromXml(SecurityElement securityElement) {
if (securityElement == null) {
throw new ArgumentNullException(SR.GetString(SR.AspNetHostingPermissionBadXml,"securityElement"));
}
if (!securityElement.Tag.Equals("IPermission")) {
throw new ArgumentException(SR.GetString(SR.AspNetHostingPermissionBadXml,"securityElement"));
}
string className = securityElement.Attribute("class");
if (className == null) {
throw new ArgumentException(SR.GetString(SR.AspNetHostingPermissionBadXml,"securityElement"));
}
if (className.IndexOf(this.GetType().FullName, StringComparison.Ordinal) < 0) {
throw new ArgumentException(SR.GetString(SR.AspNetHostingPermissionBadXml,"securityElement"));
}
string version = securityElement.Attribute("version");
if (string.Compare(version, "1", StringComparison.OrdinalIgnoreCase) != 0) {
throw new ArgumentException(SR.GetString(SR.AspNetHostingPermissionBadXml,"version"));
}
string level = securityElement.Attribute("Level");
if (level == null) {
_level = AspNetHostingPermissionLevel.None;
}
else {
_level = (AspNetHostingPermissionLevel) Enum.Parse(typeof(AspNetHostingPermissionLevel), level);
}
}