Use sitemap and role management control the navigation menu
来源:互联网 发布:windows mobile6.5应用 编辑:程序博客网 时间:2024/05/03 06:20
Use sitemap and role management control the navigation menu
Step 1: Create a sitemap file "Web.sitemap"
<?xml version="1.0" encoding="utf-8" ?><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode roles="*"> <siteMapNode title="Home" url="~/Default.aspx" > <siteMapNode title="ASP.NET AJAX Controls" roles="*"/> <siteMapNode title="WinForms Controls" roles="*" /> <siteMapNode title="WPF Controls" roles="*"/> <siteMapNode title="Silverlight Controls" roles="*"/> <siteMapNode title="Telerik Reporting" roles="User,Administrator"/> <siteMapNode title="Telerik OpenAccess ORM" roles="User,Administrator"/> <siteMapNode title="Sitefinity ASP.NET CMS" roles="Administrator"/> <siteMapNode title="WebUI Test Studio" roles="Administrator"/> </siteMapNode> <siteMapNode title="Videos" url="~/Tags.aspx" > <siteMapNode title="On-site Training" /> <siteMapNode title="Consulting Express" /> <siteMapNode title="Open Classes Training" /> <siteMapNode title="Online Training" /> <siteMapNode title="Project Consulting" /> <siteMapNode title="Telerik Webinars" /> </siteMapNode> <siteMapNode title="Members" url="~/MemberList.aspx" /> <siteMapNode title="My Page" url="~/MyPage.aspx" /> <siteMapNode title="My Recent Views" url="~/RecentViews.aspx" /> <siteMapNode title="Upload a Video" url="~/Upload.aspx" /> <siteMapNode title="Administer Users" url="~/AdministerUsers.aspx" /> </siteMapNode></siteMap>
Step 2: Add/Modify/Check Membership, Role Management database connection string
<connectionStrings> <add name="MyApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings>
Step 3: Config Sitemap provider , Role Manager , Membership Manager in web.config <system,web> node
<system.web> <compilation debug="true" targetFramework="4.0" /> <siteMap enabled="true"> <providers> <clear/> <add siteMapFile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/> </providers> </siteMap> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> <membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MyApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <roleManager enabled="true"> <providers> <clear /> <add connectionStringName="MyApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /> </providers> </roleManager> </system.web>
Step 4. Add page access rules under <configuration> node
<location path="MyPage.aspx"><system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> <location path="MyPage.aspx"><system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> <location path="MemberList.aspx"><system.web> <authorization> <allow roles="Administrator"/> <deny users="*"/> </authorization> </system.web> </location>Step 5. Add Menu to page
<asp:sitemapdatasource runat="server" id="siteMapDataSource" showstartingnode="false" sitemapprovider="AspNetXmlSiteMapProvider"> <asp:menu id="Menu1" runat="server" datasourceid="siteMapDataSource" orientation="Horizontal">Step
6.Verification ...
- Use sitemap and role management control the navigation menu
- Server 2008 R2: “You must use the Role Management Tool to install or configure Microsoft .NET”
- Server 2008 R2: “You must use the Role Management Tool to install or configure Microsoft .NET”
- You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5
- Windows 2008 R2上安装Visual Studio 2008:you must use the role management tool to install configure .net
- Use the DataList Control to Present and Edit Data...
- Umbraco(7)-The Navigation Menu And A Parent Page with Infinite Children
- 什么是MAC地址及作用管理教程——What is the MAC address and role management tutorial
- Professional ASP.NET 2.0 Security, Membership, and Role Management
- The Make or Break Role of Information Lifecycle Management @ JDJ
- 13.2. Copy Control and Resource Management
- Testing and the Role of ALL MEMBER
- use code to generate Silverlight Controls at run time, and serialize the control into XAML file
- Find the Menu Navigation for PeopleSoft Components or Processes
- Role保存Menu
- 160 You want to use the automatic management of backup and recovery operations features for your dat
- How to use the Segmented Control
- Python use Selenium to control the webdriver
- oracle 日期函数
- GDB 命令详细解释
- java.io.Read包无法引入,,, oracle + hibernate 在 update 超过1000的长度时报错
- 继承中构造函数和析构函数地调用顺序
- autoit3 ie.au3 函数之——_IEGetObjById、_IEGetObjByName
- Use sitemap and role management control the navigation menu
- malloc 与 realloc
- gcc编译选项和使用
- js中定义自己的命名空间
- 模态窗口 javascript 技巧汇总(传值、打开、刷新)
- 使用Spring替换properties文件定义属性的方法
- 如何在SQL Server中生成详细脚本
- Javascript产生随机数
- CComPtr用法