0
관리자 역할에 대해 모든 링크가 표시되고 사용자 역할에 대해 제한된 범위가 표시되는 사이트를 설정하려고합니다. 여기 관리자 대 사용자별로 다른 메뉴 항목을 표시하는 방법
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode >
<siteMapNode url="fake1.aspx" title="Example A" description="Example" roles="user">
<siteMapNode url="fake2.aspx" title="Example 1" description="Example" roles="user" />
<siteMapNode url="fake3.aspx" title="Example 2" description="Example" roles="user" />
<siteMapNode url="fake4.aspx" title="Example 3" description="Example" roles="user" />
</siteMapNode>
<siteMapNode url="fake5.aspx" title="Example B" description="Example" roles="user">
<siteMapNode url="fake6.aspx" title="Example 1" description="Example" roles="user" />
<siteMapNode url="fake7.aspx" title="Example 2" description="Example" roles="user" />
<siteMapNode url="fake8.aspx" title="Example 3" description="Example" roles="user" />
</siteMapNode>
<siteMapNode url="fake9.aspx" title="Example C" description="Example" roles="user">
<siteMapNode url="fake10.aspx" title="Example 1" description="Example" roles="user" />
<siteMapNode url="fake11.aspx" title="Example 2" description="Example" roles="user" />
<siteMapNode url="fake12.aspx" title="Example 3" description="Example" roles="user"/>
</siteMapNode>
<siteMapNode url="fake13.aspx" title="Example D" description="Example" roles="admin">
<siteMapNode url="fake14.aspx" title="Example 1" description="Example" roles="admin" />
<siteMapNode url="fake15.aspx" title="Example 2" description="Example" roles="admin" />
<siteMapNode url="fake16.aspx" title="Example 3" description="Example" roles="admin" />
</siteMapNode>
</siteMapNode>
</siteMap>
내 메뉴 서버 컨트롤입니다 :
<div id="menuBar">
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2"
Orientation="Horizontal" >
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
그리고 여기 내 역할의 스크린 샷입니다 다음에서
여기
내 사이트 맵입니다 자습서 나는 독서 역할을 해왔다 = ""는 리의 돌보기로되어있다. nks는 역할별로 액세스하지만 내 사이트에서는 아무 것도 일어나지 않습니다. 사용자와 관리자는 똑같은 것을보고 있습니다. 내가 도대체 뭘 잘못하고있는 겁니까? 는
, 나는 숨기거나 C# .NET을 사용하여 맵의 쇼 부품 수 있습니까? –
메뉴에 할당하기 전에 롤을 기준으로 데이터 소스를 스왑하거나 필터 할 수 있습니다 – DGibbs