Note that it is the Native provider (EPiServer.Web.Hosting.VirtualPathNativeProvider), not the Versioning.
The method is taking a folder value folder and builds up the path, and is just using the page ID for filename 370.xml. If the file does not exist, the file is created.
public static void UpdateRssContent() { PageData rootPage = DataFactory.Instance.GetPage(Settings.TrafficEventContainer); string filename = "/" + rootPage.PageLink.ID.ToString() + ".xml"; string path = Settings.TrafficEventRssPath.Trim('/'); // folder like: RSS VirtualPathUnifiedProvider provider = (VirtualPathUnifiedProvider)VirtualPathHandler.GetProvider("SiteGlobalFiles"); UnifiedDirectory dir = provider.GetDirectory(provider.VirtualPathRoot + "/" + path) as UnifiedDirectory; string fullpath = provider.VirtualPathRoot + "/" + path + filename; UnifiedFile rss = provider.GetFile(fullpath) as UnifiedFile; if (!provider.FileExists(fullpath)) dir.CreateFile(fullpath); Stream filestr = rss.Open(FileMode.Create, FileAccess.ReadWrite); MemoryStream outstream = TrafficEventUtils.GetRssDocument(DataFactory.Instance.GetPage(Settings.TrafficEventContainer)); filestr.Write(outstream.GetBuffer(), 0, (int)outstream.Length); Debug.Write(Encoding.UTF8.GetString((outstream.ToArray()))); filestr.Close(); }
Inga kommentarer:
Skicka en kommentar