IMembership and the MvcSiteMap provider

Oct 18, 2010 at 5:36 PM
Edited Oct 18, 2010 at 5:39 PM

I use Ninject to bind the IMembership interface to my custom IMembership implementation service, AccountMembershipService, like this:


While debugging I found out that MvcSiteMap HTML helpers (Menu(), SiteMapPath() and others) make numerous calls to AccountMembershipService constructor at page load/reload. It seems that it constructs new AccountMembershipService instance for each sitemap node. Apparently it is coming from Authorize attribute in MvcSiteMap provider implementation. What is going on? I could tell Ninject to bind it in Request scope and that would probably (but not 100% sure) resolve this issue but I would rather like to know what is going on behind the scenes. 

Oct 25, 2010 at 1:23 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.