CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/10/2007 8:23:05 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 5 Views: 24 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
AnthonySteele
Asp.Net User
Sitemap trimming not happening3/10/2007 8:23:05 PM

0

Sitemap is puzzling me a bit. I'm not getting security trimming happening, and I don't see docs on how it works with anonymous users.

 

I'm setting up a site for both anonymous and logged-in access.

I want the logged in users to see more menu items than anon users. I have not made a "users" role for all users since this seems like needless complexity - what would it mean then if a user is logged in but is not in the "users" role?

 

I've also got some admin functions that only users in the admin role can see. I've set up a Web.config and Web.sitemap that seem to be correct, but I can still see all the items even when not logged in.

The roles specification does not seem to be working, and I don't even see a way to specify that some items are barred from anon users.

 

The web.config is like this (cut down a bit):

 

<?xml version="1.0" encoding="utf-8" ?>

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

    <siteMapNode url="Default.aspx" title="Home"  description="The main page" roles="*">

        <siteMapNode url="~/Toys/apage.aspx" title="A page" />

        <siteMapNode url="~/Admin/Adminpage.aspx" title="An admin page" roles="Administrator" />

    </siteMapNode>

  </siteMap>

 

 

The web.config is like this:

 

            <system.web>

...

    <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">

      <providers>

        <add name="XmlSiteMapProvider"

          description="Default SiteMap provider."

          type="System.Web.XmlSiteMapProvider"

          siteMapFile="web.Sitemap"

          securityTrimmingEnabled="true" />

      </providers>

    </siteMap>

aghausman12
Asp.Net User
Re: Sitemap trimming not happening3/11/2007 3:12:39 AM

0

Give role=* to the pages which you want the unsigned user to access just specify roles=users,admin which you want to hide from anan user thats it.

cheers 


Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
http://www.geekswithblogs.net/aghausman
AnthonySteele
Asp.Net User
Re: Sitemap trimming not happening3/11/2007 9:57:50 AM

0

Hi

 

I have tried putting roles="*" on all other sitemap nodes, and it makes no difference, I am still seeing all entries regardless of if I am logged in as Administrator, a regular user, or not logged in at all. 

Is "users" a special, built-in role? I have stated that I have not created a role for all users.

AnthonySteele
Asp.Net User
Re: Sitemap trimming not happening3/11/2007 9:30:38 PM

0

I have replicated this in a simple app, which is completely included. I'm sure that there's something that I'm not getting that is preventing it from working correctly.

The web.sitemap is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Default.aspx" title="Home"  description="Home page" roles="*">
      <siteMapNode url="AnonPage.aspx" title="Anon"  description="Anon" roles="*" />
      <siteMapNode url="UserPage.aspx" title="User"  description="User" roles="Users" />
        <siteMapNode url="AdminPage.aspx" title="Admin"  description="Admin" roles="Admin" />
    </siteMapNode>
</siteMap>

so there is a home page, an anon page, a page for logged in users and one for admins.

The master page contains a menu to show the sitemap, as follows:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1">
            </asp:Menu>
        <br />
        <br />
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    </form>
</body>
</html>

The actual pages are all just stubs, like this:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    Default page
</asp:Content>


The web.config is as follows, with securityTrimmingEnabled:


<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug="true"/>
      <authentication mode="Forms"/>
    <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
      <providers>
        <add name="XmlSiteMapProvider"
          description="Default SiteMap provider."
          type="System.Web.XmlSiteMapProvider"
          siteMapFile="web.Sitemap"
          securityTrimmingEnabled="true" />
      </providers>
    </siteMap>
  </system.web>
</configuration>


Now when I run it, the menu shows all four items. I expected the non-anon ones to be trimmed off, since I am not in any roles. In fact there are no roles, or a database. but no trimming happens. Why am I seeing admin pages in the menu when I am not logged in?

I've had some luck adding in authorisation into web.config:
i.e.
<configuration>
 ...
system.web>

    <authorization>
      <deny users="?" />
    </authorization>


and
<configuration>
...

  <location path="default.aspx">
    <system.web>
      <authorization>
        <allow users ="*" />
      </authorization>
    </system.web>
  </location>


  <location path="anonpage.aspx">
    <system.web>
      <authorization>
        <allow users ="*" />
      </authorization>
    </system.web>
  </location>


And menu trimming happens. However, this is ignoring the roles specified in the web.sitemap file, which is defeating the point.

PDOC
Asp.Net User
Re: Sitemap trimming not happening3/27/2007 1:38:19 AM

0

Did you figure it out?

 I had the same thing, then realized the files were not being "seen" as they had been placed in a different directory...hence no trimming.

In other words the files must exist and must be correctly identified.

AnthonySteele
Asp.Net User
Re: Sitemap trimming not happening7/24/2007 3:17:59 PM

0

 I'm not using the web.sitemap file for this any more, I've got some code called from the master page that generates menu items based on logged in or not, and roles. Works great.

6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 security, membership, and role management Authors: Stefan Schackow, Pages: 611, Published: 2006
Professional Asp.Net 3.5 Security, Membership, And Role Managment With C# And Vb Authors: Bilal Haidar, Pages: 936, Published: 2008

Web:
MC9S08AW internal clock trimming - 8-Bit Microcontrollers ... So this is why the trim is not happening and why the PT option is not there in expert mode. What I don't know yet is the reason behind this. ...
Roles, sitemap, LoginVieew and RedirectFromLoginPage problems ... So far that is not happening. Instead, I am redirected back to the .... to the xml file Web.sitemap with security trimming enabled to trim ...
Videos - Free video downloads and streaming video - CNET TV Aug 27, 2008 ... There is another version of the Pilot -- it's a Trim level again that ... but not happening in our vehicle and not an ala carte option in ...
Eater Chicago: Not happening | The TOC Blog | Time Out Chicago Nov 3, 2008 ... Eater Chicago: Not happening ... Papers are trimming their staffs, restaurants are closing and even the glossiest of glossies are being ...
Ladies - You Don't Need To Become Larger and Heavier Despite your desire to be slim and trim somehow your body has not conveyed this to your mind as it is not happening the way you would like it too.

Extender and skin... - ng.asp-net-forum ... sitemap trimming not happening · linkbutton with blank target · postback and controls rendering · publicly expose specific controls in masterpage (can it be ...












trouble with displaying bitmap on webform

javascript error with standard menu

asp .net 2.0 in ie 7

simple method to substitute directories with images and the like?

free skins?

treemenu with sqlsitemapprovider + commandnotification

masterpage

xmldatasource and treeview web control

codebehind of nested masterpages

the masterpage elements such as images dont display in content page when in sub-directory

sitemappath with sql provider not work

script source dinamic

if else problem

statichoverstyle not working

menu control and safari browser

how do you customize the menu control?

split asp.net menu in a few rows

change theme css style sheet

master page question

master page and contect page in different folders

change masterpagefile in master page code

imagemap control issue

problem using master page in subfolders

question in 70-528 exam: all devices use the same master page

menu control question

master page vs frames ??

skins with background images

where to declare namespace using inline script blocks?

content page onload to change menu link on master page

master pages, cookies, session variables and life

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT