473,666 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP navigation trimming

livid86
8 New Member
Hey,

I am trying to setup my application so only users with particular roles can see navigation items that match there role. (such as admin can see the admin navigation items)

Well my problem is it's not working and i have checked several sites and found nothing. If anyone could help i would really appreciate it.

This is my code for my Web.Sitemap

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  3.  
  4.     <siteMapNode url="" title="Admin"  description="" SecurityTrimmingEnabled="true">
  5.  
  6.       <siteMapNode url="~/Admin/Default.aspx" title="Admin" description="Admin" roles="*"/>
  7.       <siteMapNode url="~/Admin/Document.aspx" title="Document"  description="" roles="Level 1 User" />
  8.       <siteMapNode url="~/Admin/DocumentGroup.aspx" title="Document Group"  description="" roles="Level 1 User" />
  9.       <siteMapNode url="~/Admin/DocumentGroupDocument.aspx" title="Document Group Document"  description="" roles="Level 1 User"/>
  10.       <siteMapNode url="~/Admin/DocumentGroupUser.aspx" title="Document Group User"  description=""/>
  11.       <siteMapNode url="~/Admin/DocumentRevision.aspx" title="Document Revision"  description=""/>
  12.       <siteMapNode url="~/Admin/DocumentSource.aspx" title="Document Source"  description=""/>
  13.       <siteMapNode url="~/Admin/DocumentViewHistory.aspx" title="Document View History"  description=""/>
  14.       <siteMapNode url="~/Admin/Request.aspx" title="Request"  description=""/>
  15.       <siteMapNode url="~/Admin/RequestStatus.aspx" title="Request Status"  description=""/>
  16.       <siteMapNode url="~/Admin/User.aspx" title="User"  description="" />
  17.       <siteMapNode url="~/Admin/UserLevel.aspx" title="User Level"  description=""/>
  18.       <siteMapNode url="~/Admin/Watermark.aspx" title="Watermark"  description=""/>
  19.       <siteMapNode url="DocumentList.aspx" title="Document List"  description=""/>
  20.  
  21.   </siteMapNode>
  22. </siteMap>
Web.Config

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <configuration>
  3.  
  4.  
  5.   <configSections>
  6.  
  7.  
  8.     <section name="DMS.Data" type="DMS.Data.Bases.NetTiersServiceSection, DMS.Data" allowDefinition="MachineToApplication" restartOnExternalChanges="true" />
  9.         <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  10.     </configSections>
  11.     <appSettings/>
  12.     <connectionStrings>
  13.  
  14.         <add name="DMS.Data.ConnectionString" connectionString="Data Source=CORY-LAPTOP\DB1;Initial Catalog=DMS;Integrated Security=true" />
  15.     <add name="ASPNETDB" connectionString="Data Source=CORY-LAPTOP\DB1;Integrated Security=SSPI;Database=DMS"/>
  16.   </connectionStrings>
  17.     <DMS.Data defaultProvider="SqlNetTiersProvider">
  18.         <providers>
  19.             <!--
  20.                 *** SqlClient Provider ***
  21.                     connectionStringName: sqlclient connection string to the db
  22.                     useStoredProcedure: if true, indicates that we use the stored procedures, otherwise, we use parametrized queries that are embedded.
  23.             -->
  24.  
  25.       <add 
  26.               name="SqlNetTiersProvider" 
  27.               type="DMS.Data.SqlClient.SqlNetTiersProvider, DMS.Data.SqlClient"
  28.               connectionStringName="DMS.Data.ConnectionString"
  29.               providerInvariantName="System.Data.SqlClient"
  30.               entityFactoryType="DMS.Entities.EntityFactory"
  31.               useEntityFactory="true"
  32.               enableEntityTracking="true"
  33.               enableMethodAuthorization="false"
  34.               useStoredProcedure="false"
  35.               defaultCommandTimeout="30"
  36.             />
  37.             <!-- 
  38.                 *** WebserviceClient Provider ***
  39.                 The url parameter indicates the webservices url (ex: http://localhost/DMS/DMSServices.aspx)
  40.                 <add 
  41.                     name="WsNetTiersProvider" 
  42.                     type="DMS.Data.WebServiceClient.WsNetTiersProvider, DMS.Data.WebServiceClient"
  43.                     url="/DMSServices.asmx" />
  44.             -->
  45.         </providers>
  46.     </DMS.Data>
  47.     <system.web>
  48.     <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
  49.       <providers>
  50.         <add name="XmlSiteMapProvider"
  51.           description="Default SiteMap provider."
  52.           type="System.Web.XmlSiteMapProvider"
  53.           siteMapFile="Web.SiteMap"
  54.           securityTrimmingEnabled="true" />
  55.       </providers>
  56.     </siteMap>
  57.  
  58.     <pages theme="default">
  59.             <controls>
  60.                 <add tagPrefix="data" namespace="DMS.Web.Data" assembly="DMS.Web"/>
  61.                 <add tagPrefix="data" namespace="DMS.Web.UI" assembly="DMS.Web"/>
  62.             </controls>
  63.         </pages>
  64.         <httpModules>
  65.             <add name="EntityTransactionModule" type="DMS.Web.Data.EntityTransactionModule, DMS.Web"/>
  66.         </httpModules>
  67.         <compilation debug="true" />
  68.     <authentication mode="Forms">
  69.       <forms    name=".ASPXAUTH"
  70.               loginUrl="Login.aspx"
  71.               protection="All"
  72.               timeout="30"
  73.               path="/"
  74.               requireSSL="false"
  75.               slidingExpiration="true"
  76.               defaultUrl="Login.aspx"
  77.               cookieless="UseDeviceProfile"
  78.               enableCrossAppRedirects="false"/>
  79.  
  80.       </authentication>
  81.     <authorization>
  82.  
  83.       <allow roles="Level 1 User"/>
  84.       <allow roles="Level 2 User"/>
  85.       <allow roles="Level 3 User"/>
  86.       <allow roles="Administrator"/>
  87.       <deny users="*"/>
  88.  
  89.     </authorization>
  90.     <membership defaultProvider="DmsMembershipSqlProvider" userIsOnlineTimeWindow="15">
  91.       <providers>
  92.         <add
  93.             name="DmsMembershipSqlProvider"
  94.             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
  95.             connectionStringName="ASPNETDB"
  96.             enablePasswordRetrieval="false"
  97.             enablePasswordReset="true"
  98.             requiresQuestionAndAnswer="true"
  99.             applicationName="DMS"
  100.             requiresUniqueEmail="true"
  101.             passwordFormat="Hashed"/>
  102.       </providers>
  103.     </membership>
  104.  
  105.     <roleManager
  106.                 enabled="true"
  107.                 cacheRolesInCookie="true"
  108.                 defaultProvider="DmsRoleManagerSqlProvider"
  109.                 cookieName=".ASPXROLES"
  110.                 cookiePath="/"
  111.                 cookieTimeout="30"
  112.                 cookieRequireSSL="false"
  113.                 cookieSlidingExpiration="true"
  114.                 createPersistentCookie="false"
  115.                 cookieProtection="All">
  116.       <providers>
  117.         <add name="DmsRoleManagerSqlProvider"
  118.             type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
  119.             connectionStringName="ASPNETDB"
  120.             applicationName="DMS"/>
  121.       </providers>
  122.     </roleManager>
  123.   </system.web>
  124.     <enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
  125.       <sources>
  126.         <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  127.             filePath="entlib.config" />
  128.       </sources>
  129.     </enterpriseLibrary.ConfigurationSource>
  130.  
  131.  
  132. </configuration>
At the moment this brings up nothing even if you are logged in as a user under level 1 user. If i remove the part in Web.Config that's in bold all users can see all menus.

Also if i try to access an admin page with a basic user it prompts me to login, (not really sure if that helps)

Thanks heaps
Jan 5 '09 #1
1 2388
livid86
8 New Member
I feel like an idiot LOL!, after hours and hours of thinking i finnally figured out the parrent needs the role set!!

Thanks anyhow
Jan 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1374
by: Simon | last post by:
Hi there. I seem to be a flurry of questions here recently, thanks for you help all, but ... got another question here. I am storing URL in a database for a 'sort of' directory type website. The <a href> is built from the recordset of URL's which is all working no problem, easy stuff.
12
17098
by: Stefan Weiss | last post by:
Hi. (this is somewhat similar to yesterday's thread about empty links) I noticed that Tidy issues warnings whenever it encounters empty tags, and strips those tags if cleanup was requested. This is okay in some cases (such as <tbody>), but problematic for other tags (such as <option>). Some tags (td, th, ...) do not produce warnings when they are empty.
0
2123
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python org, However, I haven't gotten a reply for a week or so, and figured out I could post here for a larger audience, then. Original message follows: Hello,
1
3547
by: Robert Neville | last post by:
I am having some trouble with some old code revolving around custom form navigation buttons. My main form has a sub-form with these custom navigation buttons. In other words, the code should be modular and work across forms and sub-forms. My previous code was taken from the Access Expert Solutions 97 (Leszynski) many years ago. As my database became more complex with multiple sub-forms and intricate combo boxes, the code faltered. Some...
4
3029
by: Sandy.Pittendrigh | last post by:
I don't want to get into a frames discussion here. We all know they have numerous drawbacks, especially with search engine visibility. (Google, ironically, uses framesets for displaying individual news group posts). Despite the trouble they cause, it is still tempting to use frames, occasionally, for instance for machine-generated pages that might have a large number of left-side navigation links. If you do use frames in that...
0
1204
by: Paul | last post by:
On my local site, I have a folder that is security trimmed, so that only members of a Role can see it after they register and log on (I set the memberships). All works fine locally. However, when I deployed to my ISP, the security trimming does not work. Here is the relevant code. I can add users just fine, they show up in the ISP SQL Server database, and I can log on and off.
3
2508
by: Paul | last post by:
I want the <div id="navigation"column to be the same color all the way to the bottom. The "background-image: url(bg_menu_tile.gif);" was a try to force it with a long 1-pixel graphic - didn't work. Any ideas? Here's the HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
10
2546
by: EA | last post by:
I am sure I must be missing something about building navigation bars with CSS. Yes it is a very clever and efficient way to format navigation structures on simple one navigation level webs, i.e. six buttons which when clicked go to a separate web page. But here is where I must be missing something, am I right in thinking that if you wish to have nested navigation structures then each individual page of the web site must have a different...
0
1955
by: emalcolm_FLA | last post by:
Hello and TIA for your consideration. I have created several db's for a non-profit and they want custom navigation buttons to display "You are on the first record, last record, etc". With this ng help I've created code for all except the add new record command button. If I create individual sub functions behind each form, no problem. The problem is I am trying to create a re-usable module.
0
8362
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8878
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6200
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.