protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { _robotDefinition = RobotDefinition.GetRobotDefinition(); } catch (Exception) { contentPlaceHolder.Controls.Add(new LiteralControl("You need a valid robots.config file in your ~/SiteConfig directory to visit this page.")); } } }
public static RobotDefinition GetRobotDefinition() { DataCache cache = CacheFactory.GetCache(); RobotDefinition definition = (RobotDefinition)cache["RobotDefinition"]; if (definition == null) { definition = GetRobotDefinition(GetConfigFilePathFromCurrentContext()); cache.Insert("RobotDefinition", definition, new CacheDependency(GetConfigFilePathFromCurrentContext())); } return(definition); }