Is there a way to use XmlSiteMapProvider in a WinForm / Console / VSTest application?

I wonder if there is a workaround for using the standard XmlSiteMapProvider in a non asp.net application like WinForm / Console or, in my case, VS Unit Test one.

The following code crashes because it cannot create a file path .sitemapinside a private method GetConfigDocument.

XmlSiteMapProvider provider = new XmlSiteMapProvider();
NameValueCollection providerAttributes = new NameValueCollection();
providerAttributes.Add("siteMapFile", "Web.sitemap");
provider.Initialize("XmlSiteMapReader", providerAttributes);
provider.BuildSiteMap();

I think it’s the right decision to write another provider.

+3
source share
1 answer

, . , . , , API , . WinForms URL , .

, , HttpContext Url - , -. , WinForm . , , , , API SiteMap.

API, . , , .

+2

Source: https://habr.com/ru/post/1697421/


All Articles