开发者

Return different siteMapNodes for different roles

I'm using my own SiteMapProvider which is just inherited and little bit rewritten System.Web.XmlSiteMapProvider开发者_JAVA技巧.

I want to return different siteMapNode for clients and for managers. Or maybe the same but with different Title property.

Is it possible? If yes, how can I do that?


Here is an article from Scott Gu's blog that can help you out. The example in the article is using windows authentication but it should also work for forms authentication as well.

http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx

If you want to implement different titles for different roles then here is an example of how that can be done. All you need to do is create two nodes pointing to the same url. The reasons for a=1 and a=2 as querystring vars on the url is to ensure that the url is unique. If the url is not unique, asp.net will complain, unless you can override that functionality...

    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
        <siteMapNode url="default.aspx" title="Home">
            <siteMapNode url="page1.aspx?a=1" title="Client Title" roles="Client" />
            <siteMapNode url="page1.aspx?a=2" title="Manager Title" roles="Manager" />
        </siteMapNode> 
    </siteMap>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜