SiteMap Based On User Roles Doesn't Works?
Sep 22, 2010
I have sitemap which looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/default.aspx" title="Prva stran" roles="*" description="Shema ISEF">
<siteMapNode roles="2" title="Analize" id="Analize" description="" >
<siteMapNode url="~/karneki1.aspx" title="Karneki1" description="" />
<siteMapNode url="~/karneki2.aspx" title="Karneki2" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
if I set roles in a siteMapNode with title "Analiza" it works fine, the link is not shown in the navigation... but if I set roles on any of "karneki" siteMapNode the links are still visible...
Is it even posible to restrict access to lower links based on user role?
View 1 Replies
Similar Messages:
Apr 20, 2010
<siteMapNode roles="*"> <siteMapNode url="~/Default.aspx" title=" Main" description="Main" roles="*"/> <siteMapNode url="~/Items.aspx" title=" Adv" description="Adv" roles="Administrator"/>....
any user can see Adv page. That is a trouble and a qustion : why and how to hide out of role sitenodes.
little addition : <siteMapNode roles="*"> appears to all nodes If I don't do roles="*" on main node, all users can't see Main node ... And I SiteMapDataSource works only if there 1 node
View 2 Replies
Apr 26, 2010
I created a custom forms authentication and membership provider and it seems to work fine opening up in WAT, creating roles and adding users. Also when I in my mvc app use it to log users in, it works fine. However it seems to fail to determine a user's role (no errors, but just jump over User.IsInRole(...) lines and Roles.GetRolesForUser(); comes up empty. I got a gut feeling I did something wrong with my configuration, so for now I'll post just that:
[Code]....
View 6 Replies
Jul 8, 2010
In a standard, generated list view, how can I hide certain ActionLinks based on the roles the logged in user belongs to?
View 1 Replies
Feb 23, 2011
I am using ASP.NET MVC 3. We assign roles to certain people at work, then we use Windows authentication to determine what roles a user has. Lets say the roles are RoleA, RoleB and RoleC. So now I get a list of roles for a user. Lets says that UserA belongs to RoleA and RoleB. Some of my views need to be authenticated as not everyone can view certain views. Lets say that ViewA can only be viewed by users that belong to roles RoleA and RoleB. How would I do this? What would I need to look into? When a user that does not belong to these roles tries to access the views then he/she should be redirected to an error page.
View 1 Replies
Nov 19, 2010
I'm using the built-in membership controls and classes to manage authorization and authentication in my app. Here's what I want to do: If the user is in "Manager" role, I want to send him/her to the manager page no matter where he/she came from. If the user is in "Supervisor" role, I want to send him/her to supervisor page no matter where he/she came from. However, if the user is not in any role, just a registered member, I want to send him/her back to where he/she came from as stated in ReturnUrl. If no, ReturnUrl is specified, I will send him/her to the home page.
On my login page, I'm using the Login server control but in my code behind, there's no method wired to the control because the control takes care of everything. I assume I need to add a method and wire it to the submit button, is that right? If so, I'll have to really handle the login event which means I'll need more info about how to do that.
View 6 Replies
Sep 12, 2010
I am using Formsauthentication. My situation is as per below:
the login form has codebehind :
protected void LoginButton_Click(object sender, EventArgs e)
{
TextBox uname = Login1.FindControl("UserName") as TextBox;
TextBox pass = Login1.FindControl("Password") as TextBox;
CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;
Literal fail = Login1.FindControl("Literal1") as Literal;
if (Membership.ValidateUser(uname.Text, pass.Text))
[Code].....
Now the problem is that when I try to login with proper credentials it first redirects to default.aspx( there is no such page in my project), after login again with same credentials it properly redirects to the correct page. Why such problem arises? to fix this?
View 6 Replies
Mar 22, 2010
I have a (simple) sitemap and am trying to figure out why a certain sub-menu is always visible.
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Login.aspx" title="Home" description="RivWorks" roles="*">
[code]...
I have a main menu option of "Dashboard". Under this menu item I have 2 options: 1) Campaign Manager & 2) Negotiation Manager. Now, what is interesting is when I am in either the campaigns role OR the auto-negotiation role I see the Dashboard and BOTH sub-menu items. This is not the behavior I expected. I expect to only see both sub-menus when I am in the campaigns role AND auto-negotiation role. The OR scenario should give me the Dashboard menu item and one OR the other sub-item...Am I doing something wrong here or thinking a wrong way?
View 1 Replies
Mar 26, 2010
which i added one sitemap in whcih i added all the pages n i want to retrive that sitemap in masterpage based on login in whcih suppose admin hs login then display only admin pages with sitemap n if normal user hs login then it ll display only normal user pages with sitemap. here i didn't use login control but i create login page manually.
View 1 Replies
Feb 23, 2011
I changed my application to use "InProc" sessionState instead of "Off" because I need to preserve user selected language from page to page doing localization.n web.sitemap I have this line:
<siteMapNode url="Admin.aspx" title="Administrator" description="Site administration" roles="Administrator" />
which before I changed sessionState to "InProc" worked as supposed to: menu item "Administrator" appeared as a menu choice only when user had logged in with admin rights. Now this menu choice is present for every user.
View 3 Replies
Aug 18, 2010
When I login to application, i want Button ad a Header menu like (Admin,Quote....2 button should visible).
If Login User is Admin/Quote then Click on that Button it should show all its child nodes must be as the button horizontally.
[Code]....
Even i have to write the code in the Code Behind of Site.Master. I think i need Repeter's OnItemCommand event but it does not run that methods and how can i filter the sitemap with Role in this Method? I can not able to Find the control in the Code Behind.. Is it possible to show these type of custom menus using SiteMap with Role Filteration?
View 2 Replies
Feb 24, 2011
Let's say I have a rolegroup as follows:
<asp:LoginView ID="lvDoSomeStuff" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="RoleOne,RoleTwo">
<ContentTemplate>
...
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
Is there a way I can make it so that a user must meet RoleOne and RoleTwo to satisfy the RoleGroup? By default, if a user is in either of the two roles, they will be granted access. I know I can do this via the code-behind, but I'd prefer to be able to wrap some content template with this markup instead of having to wrap it in a panel and hide the panel programmatically.
View 1 Replies
Apr 8, 2010
we are a small team of student developers and we are making a website with a silverlight application hosted on the sample website of VS 2010(i mean the one you go New website new asp.net website).But we cant understand how the login works or how we can put roles like administrator and such.Also we are using master pages and pages and i would like to know how can we make container to not being visible to an unregistered user and how to be visible in registered or better to a spesific user.
View 1 Replies
Aug 10, 2010
Scenario: building a site where navigation will be in master page in either left or top menu. What are the advantages to using the ASP.NET navigation system based on web.sitemap files? The alternative I'm considering is just building the links in <li> elements as necessary.
View 2 Replies
Dec 19, 2011
I have a web app with treeview based on a fairly simple sitemap. The only catch is that I want to be able to remove nodes based on a user's role. We are NOT using the asp.net security so I can't take advantage of the built-in function.When I put code in the master page load event (or anywhere else it seems), there seems to be nothing in the treeview object yet, so I can't make changes to it.
View 7 Replies
Jan 24, 2010
I create a site map for my site but it only works three levels deep and I need at least six. How can I do that? Every time I add a child node under "Water Filters, Desalinators or Micropur" the sitemap doesn't show the child node. Until now my sitemap only works three levels deep: Home > Products > Water Filters But I need this: Home > Products > Water Filters > Katadyn > Personal Use > Pocket Turbo 1. This is my sitemap configuration:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns=[URL] >
<siteMapNode url="~/default.aspx" title="Home">
<siteMapNode url="~/products.aspx" title="Products">
<siteMapNode url="~/waterfiltes.aspx" title="Water Filters" />
<siteMapNode url="~/desalinators.aspx" title="Desalinators" />
<siteMapNode url="~/micropur.aspx" title="Micropur" />
</siteMapNode>
<siteMapNode url="~/services.aspx" title="Services" />
<siteMapNode url="~/partners.aspx" title="Partners" />
<siteMapNode url="~/aboutus.aspx" title="About Us" />
<siteMapNode url="~/contact.aspx" title="Contact Us" />
</siteMapNode>
</siteMap>
View 8 Replies
Oct 5, 2010
I'm trying to redirect users upon login based on their roles which were defined in the Administer website feature of asp.net.Heres what I'm trying protected void Login1_LoggedIn(object sender, EventArgs e)
View 2 Replies
May 7, 2015
I create a login where both the super admin users can also login into it and the general users can also login into it..
If the super admin user logins he must land on the separate page and the general users must login to a separate page...
How it is possible...
View 1 Replies
Jan 6, 2011
How to show menu with sitemap based on sql server data?
View 1 Replies
Mar 1, 2010
I am currently working on a website with a Tab Container with roughly 5-10 tabs. I would like to have an Admin tab that is disabled to all users except those who are assigned in an Admin role (I have 2 roles, Admins and Customers). I am fairly new to ASP.NET so please bare with me. I have been crashing through it for about 3 weeks now, trying to help a friend get a site up and running!
View 6 Replies
Apr 21, 2010
I have a website where users can login and they have different roles/privileges. I want to have it where the user's view of the webpage is determined by their role. Right now I am storing the role in the UserData property of the FormsAuthenticationTicket class (which is retrieved from a database during login). When the main page is loading, I want it to check the user's role and then only show the controls/portions of the page that are for that role. For example, if the user is not an administrator, they shouldn't be able to click on a button to delete a record. At the moment I am using labels to hide or show areas depending on the user's role. Something like this:
[Code]....
[Code]....
And here is a portion of the markup code with the Labels:
[Code]....
This works, but doesn't seem to be a very good way to handle this type of thing. Is there a cleaner, more elegant way of doing this? Something similar to the LoginView control, but which I can use for roles?
View 4 Replies
Jul 4, 2010
I have implemented membership and enable role based on. I have 2 roles "admin" and "super_admin" and once the user login, I want to redirect them to different folder based on their role. My guess is, the redirection need to be determined once the user clicked login on the login control and here is my code.
[Code]....
However, whenever the user login (regardless of admin or super_admin) the page keeps redirection to Anyone/Default.aspx.
View 5 Replies
Feb 11, 2011
I'm trying to implement the following adjustments to the default ASP.NET RoleProvider so that it supports hierarchical role definitions. However i cannot create the following function, it keeps Executing the function.
Ref: [URL]
What is wrong with this function?
-- Template generated from Template Explorer using:
-- Create Multi-Statement Function (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the function.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
CREATE FUNCTION [dbo].[aspnet_Roles_Ancestor_TVF] (
@RoleId uniqueidentifier
)
RETURNS
@aspnet_Roles TABLE (
ApplicationId uniqueidentifier
, RoleId uniqueidentifier
, RoleName nvarchar(256)
, LoweredRoleName nvarchar(256)
, Description nvarchar(256)
, ParentRoleId uniqueidentifier
)
AS
BEGIN
; WITH aspnet_Roles_CTE (
ApplicationId
, RoleId
, RoleName
, LoweredRoleName
, Description
, ParentRoleId
, HierarchyLevel
) AS (
[Code.....]
View 2 Replies
Mar 26, 2012
I have a bunch of divs that are widgets. I am using a custom role provider and I need to hide the divs based on roles. Is it better to add a "runat=server" attribute to the div so that I can hide/unhide in the code behind? Should I hide/unhide on the aspx page or do i use panel controls and hide/unhide in the code behind?
View 1 Replies
Jan 21, 2010
My web app has 3roles, I need to lock down certain sitemap menu items based on the users role and what I'm using isn't working.
my roles are Supervisor, manager, and User.
[Code]....
I only want those roles to see those menu options, I do not want someone with a user role to see those options at all. Currently if I log into my site with a user role, I'm seeing everything on the menu (via the sitemap).
View 5 Replies