473,770 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MenuitemDataBou nd With roles

5 New Member
Hi everyone

I am using a mainmenu witeh sitemap provider
with folowing sitemap
<siteMapNode>
<siteMapNode url="" title="Master Data" description="En ter Master data" roles ="Admin,PM">
<siteMapNode url="~/PL/Master/ViewProjects.as px" title="Projects " description="Vi ew/Add Projects" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/AssignProject.a spx" title="Assign Project" description="En ter User Details details" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/Addtask.aspx" title="Tasks" description="Ne w Task" roles ="Admin,PM"/>
<siteMapNode url="~/PL/Master/AssignTask.aspx " title="Project Tasks" description="As sign Task to Projects" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/ClientDetails.a spx" title="Clients" description="Vi ew/Add clients" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/Createuser.aspx " title="Create New User" description="Cr eate New User" roles ="Admin,PM"/>
<siteMapNode url="~/PL/Master/EmployeeDetails .aspx" title="Employee s" description="Em ployee Details" roles ="Admin,PM"/>
</siteMapNode>

<siteMapNode url="" title="Timeshee t" description="En ter timesheets" roles ="Admin,PM,Emp" >
<siteMapNode url="~/PL/Timesheet/Timesheet.aspx" title="Timeshee t" description="Bi lling Description" roles ="Admin,PM,E mp" />
</siteMapNode>

<siteMapNode url="" title="Reports" description="Ge nerate Reports" roles ="Admin,PM,Emp" >
<siteMapNode url="~/PL/Timesheet/ViewTimeDetails .aspx" title="View Time Report" description="Vi ewTimeDetails" roles ="Admin" />
<siteMapNode url="~/PL/Timesheet/ReportProject.a spx" title="Project Report" description="Vi ewTimeDetails" roles ="Admin" />
<!--<siteMapNode url="PL/Reports/EmplDate.aspx" title="Employee Date Report" description="Em ployee totals" roles ="Admin" />
<siteMapNode url="~/PL/Reports/EmplReport.aspx " title="Employee Project Report" description="Em ployee Report" roles ="Admin" />
<siteMapNode url="~/PL/Reports/ProjectReport.a spx" title="Project Report" description="Cl ient Project Report" roles ="Admin" />-->
</siteMapNode>

on the basis of roles i want to hide some nodes reports sections for differnt user

Following code is binding menu
protected void MainMenu_MenuIt emDataBound(obj ect sender, MenuEventArgs e)
{
System.Web.UI.W ebControls.Menu menu = (System.Web.UI. WebControls.Men u)sender;
SiteMapNode mapNode = (SiteMapNode)e. Item.DataItem;

if(! mapNode.Roles.C ontains( Session["Roles"].ToString()))
//if ( Session["Roles"].ToString()!=ma pNode.Roles[0].ToString())
{
System.Web.UI.W ebControls.Menu Item itemToRemove = menu.FindItem(m apNode.Title);

if (itemToRemove != null)
{
menu.Items.Remo ve(menu.FindIte m(mapNode.Title ));
}

}

}

Please telll me how to bind for submenus?accord ing to roles describe
Apr 3 '07 #1
0 2697

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

Similar topics

1
3614
by: Mad Scientist Jr | last post by:
I would like to write a vb.asp.net function Private Function fn_sGetRoles(byval sDelimiter as string) As String that simply returns a delimited list of all the roles a user belongs to. I did some research, and found a number of solutions, that all seem to use a WindowsIdentity type object. However, when I try to convert
5
2139
by: hansiman | last post by:
Following http://aspnet.4guysfromrolla.com/articles/082703-1.aspx I've set up roles authentication for my web application. User's roles are registered by: HttpContext.Current.User = _ New GenericPrincipal(User.Identity, roleListArray) I'd like to enter a user's roles into a listbox for viewing.
7
1992
by: Matthias S. | last post by:
Hi, here is what I'm trying to do: I have a virtual directory called "WebApp". Under this one I've got 2 physical directories called "Customers" and "Admins". I implemented Forms-based authentication. If the logon credentials are ok, I transfer the user to either the "Customers" or the "Admins" subdirectory. Those two directories should have a web.config file, which allows the roles "Admins" and "Customers" access the resources in the
1
2012
by: chris.rust | last post by:
Has anyone else had any trouble setting up a sitemap view to be filtered by roles? We've put a cust role provider in place, and we can verify that it's only being called once for each connection, and is returning the correct roles, but... When we specify a role on the top sitemapnode that role seems to add to the roles on lower level nodes, so we end up needing to put roles="*" on the top node, but then regardless of which role we put...
9
4277
by: Mike Hofer | last post by:
BACKGROUND: We've designed a Website for a client that will be deployed across multiple physical locations. The site will be hosted from a corporate NOC, and administered by the IT group there. The site's end-users tend to fill each others' roles on a pretty frequent basis. Their permissions in the system have to be extremely flexible. We initially wanted to use role-based security, defining concrete roles, but when we realized how these...
1
2556
by: jesibl | last post by:
Hi All, I have an ASP .NET 2.0 web based app which should change content based on a variable passed in the query string. Let's say the variable is called ID and the variations are A, B and C. I put this value into a Session variable and make changes based on that. The website needs to provide authorisation based on roles. I was planning on using the roles and authorisation techniques introduced by 2.0. A, B and C each have their...
0
4500
by: Douglas J. Badin | last post by:
Hi, The problem with Authorization is it stops at the first match and doesn't permit Grouping. On the Web Site, I am trying to Secure Page Access and SiteNaviagation by implementing the following ASP.NET 2.0 features: - Membership - Site Maps
4
3275
by: AC | last post by:
Hi there. My asp.net 2.0 development website uses roles to control access to sections of my site, configured using the asp.net configuration tool, which is great. Except that isn't available once published on the public, third-party hosted site. So I need to be able to configure access through a new section of the site, available only to admins/developers, which I'm about to write. First off, I want to create a role in the database to...
2
5613
by: Nathan Sokalski | last post by:
When I call System.Web.Security.Roles.GetRolesForUser() it returns no results (an array of length 0) even though I have roles associated with the currently logged in user. I am able to get the username by calling System.Web.Security.Membership.GetUser().UserName. Why am I unable to get the Roles, and what could I need to change? The <membershipand <roleManagerelements in my Web.config are as follows: <membership...
0
9439
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
10071
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
10017
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
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
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
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.