In order to prevent the usual issues where I have an Xml file in a folder in one project and want to access it from other projects and have to deal with the file path issues, I want to download the Xml file contents directly from Azure blob storage where it resides now.
Not sure how to accomplish that although I see many examples of how to download images into streams, not sure how that works for Xml.
I am currently using the following ( which works until I move the Xml file)
public class MenuLoader
{
//var rootpath = HttpContext.Current.Server.MapPath("~");
private static readonly string NavMenuXmlPath = Path.Combine(ServicesHelpers.GetClassLibraryRootPath(),
@"ServicesDataFiles\MRNavigationMenu.xml");
);
//load the menus, based on the users role into the AppCache
public static void LoadMenus(IPrincipal principal)
{
var navXml = new NavigationMenusFromXml(NavMenuXmlPath);
var nmim = new NavigationMenuItemManager(navXml);
AppCache.Menus = nmim.Load(principal);
}
}
I want to eliminate all the bs associated with path combining and just download the xml from the file on Azure, i.e. replacing the string
@"ServicesDataFiles\MRNavigationMenu.xml"
with
"https://batlgroupimages.blob.core.windows.net:443/files/MRNavigationMenu.xml"
Naturally, that wouldn't work but there must be someway to load that xml into a file variable for use with the method.
Note: That is a publicly accessible file on azure for testing.