maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
537 stars 220 forks source link

Sitemap without HttpContext #408

Closed gaspardle closed 8 years ago

gaspardle commented 8 years ago

Hi,

Is it possible to retrieve the sitemap without having an HttpContext?

NightOwl888 commented 8 years ago

No.

But you can fake it by creating your own instance of HttpContext as shown here. We use that technique for both the AuthorizeAttributeAclModule and the SiteMapNodeUrlResolver.

However, I have never tried to get the entire thing to work with a fake HttpContext. You would also need to have a fake RequestContext as well so all of the route values would be available to match.

NightOwl888 commented 8 years ago

Closing as it appears this issue is resolved. Feel free to reopen if that is not the case.