private void LoadConfiguration() { Util.set_context(HttpContext.Current); // required for map path calls to work in util.cs StreamReader sr = File.OpenText(Util.GetAbsolutePath("custom\\custom_header.html")); Application["custom_header"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(Util.GetAbsolutePath("custom\\custom_footer.html")); Application["custom_footer"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(Util.GetAbsolutePath("custom\\custom_logo.html")); Application["custom_logo"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(Util.GetAbsolutePath("custom\\custom_welcome.html")); Application["custom_welcome"] = sr.ReadToEnd(); sr.Close(); if (Util.get_setting("EnableVotes", "0") == "1") { Tags.count_votes(Application); // in tags file for convenience for me.... } if (Util.get_setting("EnableTags", "0") == "1") { Tags.build_tag_index(Application); } }
public void Application_OnStart(Object sender, EventArgs e) { string path = HttpContext.Current.Server.MapPath(null); HttpRuntime.Cache.Add("MapPath", path, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); HttpRuntime.Cache.Add("Application", Application, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); string dir = path + "\\App_Data"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } dir = path + "\\App_Data\\logs"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } dir = path + "\\App_Data\\uploads"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } dir = path + "\\App_Data\\lucene_index"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } Util.set_context(HttpContext.Current); // required for map path calls to work in util.cs StreamReader sr = File.OpenText(path + "\\custom\\custom_header.html"); Application["custom_header"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(path + "\\custom\\custom_footer.html"); Application["custom_footer"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(path + "\\custom\\custom_logo.html"); Application["custom_logo"] = sr.ReadToEnd(); sr.Close(); sr = File.OpenText(path + "\\custom\\custom_welcome.html"); Application["custom_welcome"] = sr.ReadToEnd(); sr.Close(); if (Util.get_setting("EnableVotes", "0") == "1") { Tags.count_votes(Application); // in tags file for convenience for me.... } if (Util.get_setting("EnableTags", "0") == "1") { Tags.build_tag_index(Application); } if (Util.get_setting("EnableLucene", "1") == "1") { MyLucene.build_lucene_index(Application); } if (Util.get_setting("EnablePop3", "0") == "1") { MyPop3.start_pop3(Application); } }