2011-11-29 18 views
0

我正在使用VS2005,並且在站點地圖選項卡上遇到了一些問題。ASP.NET站點提供商sitemap選項卡不顯示

我在ASP.NET配置工具中分配了2個角色,併爲每個用戶分配了一個角色。

我的登錄正常工作,並且訪問控制正在工作。如果我沒有登錄,我嘗試訪問角色受限頁面,它會將我重定向到登錄頁面。

但是,當我登錄時,有些網站節點會在我用正確的特權用戶登錄時顯示,但它仍不會顯示。


前登錄: enter image description here


登錄後:enter image description here

從截圖上面,我的節點僅表現在兩個登錄和未登錄Home我應該看數據庫管理選項卡,它不受限制爲admin01


下面是我Web.config代碼片段:

<system.web> 
    <authentication mode="Forms" /> 
    <roleManager enabled="true" /> 
    <pages styleSheetTheme="DataWebControls" /> 

     <siteMap defaultProvider="XmlSiteMapProvider" enabled="true"> 
      <providers> 
       <add name="XmlSiteMapProvider" 
        description="Default SiteMap provider." 
        type="System.Web.XmlSiteMapProvider" 
        siteMapFile="Web.sitemap" 
        securityTrimmingEnabled="true" /> 
      </providers> 
     </siteMap> 
     <compilation debug="true"/> 
    </system.web> 

如果我從<siteMap></siteMap>刪除整個代碼,我的節點將顯示爲正常:

enter image description here


我不期待一個完美的解決方案,因爲我不知道我提供的信息是否足夠,但我會很感激任何幫助。

如果需要更多信息,請告訴我,我會提供更多信息。

謝謝


編輯:新增Web.sitemap代碼片段:

<siteMapNode url="/Project/Default.aspx" 
      title="Home" description="Home"> 

    <siteMapNode title="Database Management" 
    description="Database tab"> 

     <siteMapNode url="/Project/Database/Employee.aspx" 
     title="Employee" 
     description="" /> 

     <siteMapNode url="/Project/Databaase/Customer.aspx" 
      title="Customer" 
      description="" /> 

     <siteMapNode url="/Project/Database/Goods.aspx" 
      title="Goods" 
      description="" /> 

     <siteMapNode url="/Project/Database/Transactions.aspx" 
      title="Past Transactions" 
      description="" /> 

    </siteMapNode> 

</siteMapNode> 

編輯:在文件夾中添加/Project/DatabaseAccess role screenshot

enter image description here enter image description here


附加信息:

即使沒有創建的訪問規則,用戶不與任何角色分配,則Database節點仍未顯示

+0

看來我們的web.sitemap文件配置不正確。你能否請編輯你的文章,並添加你的web.sitemap,並添加一些信息,你在項目中定義了什麼樣的角色 - thx –

+0

如果sitemab選項卡不包含在web.config中,我的站點地圖可以顯示 – gymcode

回答

1

我想我找到了一個解決方案給你。

該網站CONFIGS被限制訪問...

首先,請允許訪問,然後否認:

<configuration> 
    <system.web> 
     <authorization> 
      <allow roles="Admin1" /> 
      <deny users="*" /> 
     </authorization> 
    </system.web> 
</configuration 

,當我做到這一點,反之亦然鏈接disaappears並以上述方式出現。 。

希望它能解決您的問題....因爲我爲此創建了一個解決方案並進行了測試。 (因爲我使用sqlsitemapprovider)

1

你試過添加角色屬性到相關的sitemapnodes?

<?xml version="1.0" encoding="utf-8" ?> 
<siteMap> 
<siteMapNode url="/Project/Default.aspx" 
      title="Home" description="Home"> 

    <siteMapNode title="Database Management" 
    description="Database tab" roles="Admin"> 

     <siteMapNode url="/Project/Database/Employee.aspx" 
     title="Employee" roles="Employee,Admin" 
     description="" /> 

     <siteMapNode url="/Project/Databaase/Customer.aspx" 
      title="Customer" roles="Customer,Employee,Admin" 
      description="" /> 

     <siteMapNode url="/Project/Database/Goods.aspx" 
      title="Goods" 
      description="" /> 

     <siteMapNode url="/Project/Database/Transactions.aspx" 
      title="Past Transactions" 
      description="" /> 

    </siteMapNode> 
</siteMapNode> 
</siteMap> 

你檢查,在添加到您限制訪問的文件夾中的網站管理工具的web.config文件中?由於有時問題在於..

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
    <authorization> 
     <allow roles="Admin,Employee" /> 
     <deny users="?" /> 
    </authorization> 
    </system.web> 
</configuration> 
+0

我檢查了web.config '每個文件夾中的文件,授權都是正確的。我也嘗試添加在我的siteMapNods中的角色,但它仍然不起作用。 – gymcode