开发者

MVC sitemap provider

开发者 https://www.devze.com 2023-03-21 13:52 出处:网络
In mvc sitemap provider I want to show a list menu\'s based on the id of the logged in user.I was thinnking about dynamicnodeprovider but it is working for the first request it self that is before log

In mvc sitemap provider I want to show a list menu's based on the id of the logged in user.I was thinnking about dynamicnodeprovider but it is working for the first request it self that is before logging i开发者_开发问答n.How can i achieve this?

Thanks, Ajai


You could use cookies to achieve that. Set a cookie when the user logs in and read it when he comes back. Obviously this wouldn't work if:

  • the user blocks cookies
  • the user visits the site for the very first time

so you would need a default view for first visits; i don't think you can avoid this problem.


You could take the approach of making a JQuery AJAX call to a controller method which returns the required sitemap information. This enables you to update the sitemap whenever you like based on client side events.

e.g. see this post : http://joelabrahamsson.com/entry/xml-sitemap-with-aspnet-mvc

Another decision is if you want the controller to return the sitemap as ready generated HTML and dynamically replace it in the DOM. Or ( more work ) return the pure sitemap in XML and have JQuery generate the SiteMap markup for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消