CodeVerge.Net Beta


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

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 11/12/2006 7:01:07 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 41 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
slasi.net
Asp.Net User
How to: change the menu control by the correct user role11/12/2006 7:01:07 PM

0/0

Hi to all,

 i am intersting to fin out how can i modify dinamcly the menu control which based on sitemap xml file.

in the sitemap i have added the role attribute to administrator so now i have links with role="*" and links with role="administrator".

how can modify the menu control so he will show everybode the links with role="*" and only to user how login in as administrators the control will show the role="administrator" as well.

 i have folloed the article: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/navigation/sitenavapi.aspx#security with out success.

what is the line that retrive to the control all link which are role="administrator" from the web.sitemap file.

( its not HttpContext.Current.User = new GenericPrincipal(HttpContext.Current.User.Identity,new string[]{"Administrators"});)

 

Thank you for all your help

 Ori

sbyard
Asp.Net User
Re: How to: change the menu control by the correct user role11/12/2006 8:53:40 PM

0/0

Look mys simple site map below. I added an attribute called administratorsRole.  I will set this to true or false, but you can add your own for a multitude of roles, and use "Y" or "N" etc.

In my control in the web page - but usually put on a master page, I have a menu control.

To simplify and expand the example out, I first select the associated site map node for each one being rendered

I pick up my attribute and convert to a bool

Lastly, I set whether the menu item is selectable by chjecking if this is an admin menu, and the user is in the admin role

Job done

 

<?

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

<

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

<

siteMapNode url="default.aspx" title="Main Page" description="">

<

siteMapNode url="AdminPage.aspx" title="AdminPage" description="" administratorsRole="true" />

</

siteMapNode>

</

siteMap>

 

<%

@ Page Language="C#" %>

<!

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

<

script runat="server">

protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)

{

SiteMapNode smn = (SiteMapNode)e.Item.DataItem;

bool requiresAdmin = Convert.ToBoolean(smn["administratorsRole"]);

e.Item.Selectable = requiresAdmin && User.IsInRole(

"Administrators");

}

</

script>

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" OnMenuItemDataBound="Menu1_MenuItemDataBound">

</asp:Menu>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

&nbsp;

</form>

</

body>

</

html>

If it was easy, everybody would be doing it.
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Mastering Web Development with Microsoft Visual Studio 2005 Authors: John Paul Mueller, Pages: 822, Published: 2005
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
Professional Community Server Authors: Wyatt Preul, Keyvan Nayyeri, Jose Lema, Jim Martin, Pages: 311, Published: 2007
Blackboard For Dummies Authors: Howie Southworth, Kemal Cakici, Yianna Vovides, Susan Zvacek, Pages: 356, Published: 2006
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
DVD Studio Pro 2 Solutions Authors: Erica Sadun, Pages: 384, Published: 2004
Visual Web Developer 2005 Express Edition For Dummies Authors: Alan Simpson, Pages: 358, Published: 2005
The Design and Implementation of Geographic Information Systems Authors: John E. Harmon, Steven J. Anderson, Pages: 264, Published: 2003
Enterprise Resource Planning for Global Economies: Managerial Issues and Challenges Authors: Carlos Ferran, Ricardo Salim, Pages: 388, Published: 2008
Security, Audit, and Control Features SAP R/3: A Technical and Risk Management Reference Guide Authors: Information Systems Audit, Information Systems Audit and Control Association, Control Association, Pages: 320, Published: 2006

Web:
Changing Menu control based on user Roles. - ASP.NET Forums Re: Changing Menu control based on user Roles. ... ...
CodeProject: Populating Menu Control in ASP.NET 2.0 - using ... An article on how to populate the Menu control in ASP. ... I want to create menu depending on login user's role so i can provide user correct links. ...
ASP.NET Menu Control Overview Static display means that the Menu control is fully expanded all the time. The entire structure is visible, and a user can click on any part. ...
[#CLK-406] Menu improvements - plug-able role checking. - Click ... Right now the Menu Control is using HttpRequest#isUserInRole(String role), but most webapplications don't use this strategy for user/roles management, ...
Flex 3 - Menu-based control events MenuBar control. For the menu bar, the following events occur:. change. ( MenuEvent.CHANGE) Dispatched when a user changes current menu bar selection by ...
A Role-Based Access Control (RBAC) system for PHP May 13, 2004 ... Introduction; What is 'access control'? What is 'role based'? .... Every user always started at the same menu page after logging on, ...
Table of content for an authorization concept | MarieWagener.de Change of responsibilities 9.4.3. Change and deletion 9.4.4. User master records in the system 9.5. Administration of roles 9.5.1. Principle of menu control ...
Roles and Permissions | Adobe Connect Community To change the role of a Participant, select the name in Current Participants list and select the new role from the “Set User Role” menu at ...
Microsoft SharePoint Team Blog : Customizing the WSS 3.0/MOSS 2007 ... re: Customizing the WSS 3.0/MOSS 2007 Menu Control -- MossMenu source code released. Hi,. I need to change the image in the Menuitems "OnmouseOver" and ...
How To Use Tree Menu Based On User Credentials ( Logged In User ... This allows the developer to show different menu based on user roles (non member , member, ... This article will demonstrate how to use a Tree Menu Control. ...

Videos:
Randy Pausch - Really Achieving Your Childhood Dreams Randy Pausch's Last Lecture with English and German subtitles by Friederike Sophie Brand, Spanish subtitles by Carlos Velásquez and Ezequiel ...
Exploratory Testing Google Tech Talks March 16, 2006 Jon Bach
Full Focus: Tax Returns For Sale; New Medicine; Violinist ... new IRS proposal would make this legal with just a signature on a consent form. On Wednesday's Full Focus, it's a marketer's dream -- but could ...
Charlie Rose - An hour with author Bill Buford An hour all about food, cooking, and restaurants with author Bill Buford. His new book is "Heat: An Amateur's Adventures as Kitchen Slave, Line ...




Search This Site:










bulk email using windows services

how to read content from a page

comparevalidator issue: rise the date value to compare

what event can i catch this exception: 'ddlnames' has a selectedvalue which is invalid because it does not exist in the list of items.

passing multiple values to navigateurl in an asp:hyperlink control

call sub after search

how to select date from calendar control?

control load at runtime

popup calendar question

need to print in landscape

asp.net and jscript questions

how to: attach re: to subject

how i display my information..

add javascript event to a usercontrol

build error? i think its a handle? related to a control.

change xmleditgrid properties

htmlinputfile - moving the associated button

code to encrypt the password or any string

vb messagebox.show("message") in aspx ???

download files from image bank

cdonts

enabling button but not firing server side click event

crystal report report format

menus in asp.net

how to prevent users from choosing the first item in a dropdown list

sorting one ddl depending on another ddl

calendar control selectionchanged

display html in a textbox

buttons just stop working

how to have an injected i.e. dynamically added control always appear at top of a page?

  Privacy | Contact Us
All Times Are GMT