@using System.Configuration @{ var blogsXmlFile = Server.MapPath("~/App_Data/communityblogs.xml"); var random = Guid.NewGuid(); var yahooPipesId = ConfigurationManager.AppSettings["YahooPipesId"]; var url = string.Format("http://pipes.yahoo.com/pipes/pipe.run?_id={0}&_render=rss&rnd={1}", yahooPipesId, random); if(File.GetLastWriteTime(blogsXmlFile) < DateTime.Now.AddMinutes(-60)) { string html = ""; using(WebClient client = new WebClient()) { html = client.DownloadString(url); } html = html.Replace(string.Format("http://pipes.yahoo.com/pipes/pipe.info?_id={0}", yahooPipesId), "http://our.umbraco.org/rss/communityblogs/"); html = html.Replace(string.Format("http://pipes.yahoo.com/pipes/pipe.run?_id={0}&_render=rss&page=2", yahooPipesId), "http://our.umbraco.org/rss/communityblogs/"); using(StreamWriter writer = new StreamWriter(blogsXmlFile, false)) { writer.WriteLine(html); } } string blogs = File.ReadAllText(blogsXmlFile); Response.ContentType = "application/xml"; Response.Write(blogs); }