public static GetSecurityFilePathFromCurrentContext ( ) : string | ||
Résultat | string |
public static void SetSecurity(SiteSecurityConfig ssc) { XmlSerializer ser = new XmlSerializer(typeof(SiteSecurityConfig)); using (StreamWriter writer = new StreamWriter(SiteConfig.GetSecurityFilePathFromCurrentContext())) { ser.Serialize(writer, ssc); } }
public static SiteSecurityConfig GetSecurity() { string fullPath = SiteConfig.GetSecurityFilePathFromCurrentContext(); //if (HttpContext.Current != null) //{ // fullPath = HttpContext.Current.Server.MapPath("~/SiteConfig/siteSecurity.config"); //} //else //We are being call on a background thread... //{ // fullPath = Path.Combine(HttpRuntime.AppDomainAppPath,"SiteConfig/siteSecurity.config"); //} // [email protected] 18-MAY-04 // When the current page is below the root directory, try the directory above // for the location of the security config file. // // Typically the siteSecurity.config file will not exist in the cases where // the page checking the current user is below the root web directory. For // example, /ftb/ftb.insertcode.aspx, or /ftb/ftb.imagegallery.aspx // // Note that I have only seen this problem when NT Authentication is being // used at the site level. /* Do we really need this? * * if ( !File.Exists(fullPath) ) * { * fullPath = HttpContext.Current.Server.MapPath("~/SiteConfig/siteSecurity.config"); * } */ if (File.Exists(fullPath)) { return(GetSecurity(fullPath)); } return(new SiteSecurityConfig()); }