Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










C# - Create Menu Dynamically Based On User's Role?


How do I create a menu in a ASP.NET MVC2 Master Page, dynamically based on the current user's "role"?


View 3 Replies (Posted: Apr 18 10 at 21:41)

Sponsored Links:

Related Forum Messages For ASP.NET category:
Web Forms :: How To Display Master Pages Dynamically Based On User Role
I have two roles Admin and User for my website(using asp.net 2.0, c#)

and I have two master pages UserMaster.master and AdminMaster.master

and i have some specific aspx pages for Admin user and some other aspx pages common for any user.

I want to use AdminMaster.master page for an aspx page if admin
user is logged inand want to use UserMaster.master page for the same aspx page if general user(User role) is logged-in.

Posted: Aug 29, 2009 03:53 PM

View 5 Replies!   View Related
Security :: Default Membership's Role Based Menu?
I have a website created in ASP.Net 3.5(C#) and I have configued asp.net defalut membership provider for it.There are 5 different type of roles in this site. Now I want to display a small role based (i.e. depending upon the logged in user's role) menu whenever a user log-in to the site.For this I have added the code in the OnPageLoad() event of the master page, here is the code -

[Code]....

Now I wanted to know Is this code is logcally correct? And what is the security level of this code?

Posted: May 04, 2010 05:47 PM

View 5 Replies!   View Related
Web Forms :: How To Create Controls Dynamically Based On User Input
could u tell meadd controls to a page base on user inputs,

i know the basic of creating a button dynamically but here Ihave to toadd few controls based on user inputand how to identify event for each dynamically create control.

Posted: Apr 20, 2010 11:00 AM

View 2 Replies!   View Related
Forms Data Controls :: Display Menu Items Based On Role?
I hv created menu using sitemap xmldatasource now i want to display that based on Category or Roles. I have Created 4 Category in my sql Server 2005. when particular user logged in based on his Category menu nodes should display.

Posted: Jul 13, 2010 06:46 AM

View 7 Replies!   View Related
Security :: Lock Down Certain Sitemap Menu Items Based On The Users Role ?
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).

Posted: Jan 21, 2010 05:25 PM

View 5 Replies!   View Related
Security :: Enable User To Edit / Delete Based On User's Role Permission
I'm trying to allow logged user who are in department XYZ to perform some task for my third party App. I have two SQL tables named Users & UserList. The third party app (GoldMine) graps the USERNAME from the Users table and store it as UserID which I then referecnce SessionID.The UserList table has two columns (GM_UserName & Department) which I'm interested in. When a user login into the 3rd party app (GoldMine), i then compare the USERNAME (from Users table) to GM_UserName (from UserList table) and see whether GM_UserName is in = 'Dept XYZ'. Take a look at the SQL query below.

sqlDept="SELECTUSERNAMEFROMUsersLEFTJOINUserListONUserList.GM_UserName=Users.UserNameWHEREUserList.Department='Dept XYZ'"

I'm able to do this.

IfSession("Userid")="TestUser1"OrSession("UserID")="TestUser2"ThenDo thisElse Do thatEndIf
BUT unable to do this...
If user's Department = 'Department XYZ' Then
Do This
Else
Do that
End IF

Posted: Feb 24, 2011 02:39 PM

View 2 Replies!   View Related
MVC :: Strongly Typed User Control On All Pages Based On Login Status And User Role
I want to display a menu (which will be strongly typed with it's own unique model) across all pages only if a user is logged in.What menu items are available depend on the user's role and also I'll need to hit the repository to get numbers like "x Messages", etc

Been scratching my head for a simple solution here. Don't want to create something that need changes all over the place.All my controllers derive from a BaseController, all my Models from BaseViewModel....probably where I'll be implementing functionality for this.

Posted: May 09, 2010 05:31 PM

View 3 Replies!   View Related
Security :: Want To Redirect The User After The Log In Based On His Role?
i want to redirect the user after the log in based on his role. e.g. admin, userI already read the other threads.. I already used this:

[Code]....

And this:

[Code]....

I also tried the above codes on the Page_Load event.

Posted: Mar 17, 2011 12:13 AM

View 7 Replies!   View Related
C# - Access Datas Based On User Role?
How to access datas based on user roles in asp.net ? For example : i have two admins (admin1, admin2). In the frontend ,admin1 has full access to datas(view,add,edit,delete all datas) while admin2 has limited access to datas(view,add,edit,delete certain datas alone and not all datas)

Posted: Mar 21 at 11:15

View 2 Replies!   View Related
Security :: How To Redirect Logged In User Based On Role
I want to know how can i redirect a user to a different page when he tries to accessa page restricted to another role?

The scenario is as follows:

I have a folder "Gestao" that only allows users in role "Administrator"

[Code]....

If ananonymoususer tries to access that folder he is redirected to the login page, but if a logged in user whose role is "friend" tries to access this folder he is also redirected to the login page. I want to redirect him to a page showing a message that he has no permission to access that page/area.

How canI do that? Should i have code on the Page_load event of the login page checking the user role and then redirect him to the correct page? Or is there some otherway to do this?

Posted: Nov 25, 2010 09:18 PM

View 2 Replies!   View Related
MVC :: How To Add The Privileges To Limit Actions Based On The Role Of The User
Im going to develop an application with MVC.My app should have different kinds of users with different privileges...Users should also have a relation with one of many deparments.Im using Linq2sql classes.Questions:Should I use the built in system authentication?How should I implement it so that I can relate Users with departments??How would I add the privileges to limit actions based on the role of the user??..This is all pretty basic so Im sure I shouldnt need anything beyond the built in authentication system... correct?

Posted: Aug 14, 2009 02:14 AM

View 2 Replies!   View Related
Authentication - How To Limit .net Control Actions Based On User Role
I have several pages or views in my application which are essentially the same for both authenticated users and anonymous users. I'd like to limit the insert/update/delete actions in formviews and gridviews to authenticated users only, and allow read access for both authed and anon users.

I'm using the asp.net configuration system for handling authentication and roles. This system limits access based on path so I've been creating duplicate pages for authed and anon paths.The solution that comes to mind immediately is to check roles in the appropriate event handlers, limiting what possible actions are displayed (insert/update/delete buttons) and also limiting what actions are performed (for users that may know how to perform an action in the absence of a button.) However, this solution doesn't eliminate duplication - I'd be duplicating security code on a series of pages rather than duplicating pages and limiting access based on path; the latter would be significantly less complicated.I could always build some controls that offered role-based configuration, but I don't think I have time for that kind of commitment right now.Is there a relatively easy way to do this (do such controls exist?) or should I just stick to path-based access and duplicate pages?

Does it even make sense to use two methods of authorization? There are still some pages which are strictly for either role so I'll be making use of path-based authorization anyway.Finally, would using something other than path-based authorization be contrary to typical asp.net design practices, at least in the context of using the asp.net configuration system?

Posted: Mar 12 10 at 14:22

View 3 Replies!   View Related
Security :: Redirect User Based On Role To Specific Web Page?
I'm not sure if this is possible or not, I'm using Roles to limit whatpages a user canaccess based on there assigned Role.My question, is there anyway toredirect the user to a specific web page based on thier role after they login.

For example:

If Bob logs in with Role="Automotive", I want him to be redirected to Auto.aspx.If sue logs in with Role="Clothing", i want her to be redirected to cloths.aspx.

Posted: Apr 22, 2010 07:22 PM

View 8 Replies!   View Related
Filtering Repeater Items Based On User Status / Role?
I have a tricky requirement where I need to categorise documents attached to a product, available for download, based on the status of the user viewing the product. I.e. my site displays a list of products, clicking on one displays a product details page, and this page includes a list a documents related to the product, such as data sheets, user manuals, etc.

I have been asked to group documents into three classes of availability, v.i.z. those available freely to all users, including anonymous; those available to logged on users; and those available to anonymous users that provide contact information before downloading the document, presumably to boost sales leads.

The anonymous and logged on availabilities are quite easy, but the third seems a bit tricky to me. My first question is, is there a way I can filter documents for only logged on users without hooking into ItemDataBound or something, and my second question is, what is recommended for the case where a user must supply contact information to download a document?

In the second question, it has crossed my mind to actually register the user, but without them having to visit the new user registration page, and then I have role based filtering of documents. Currently the new user registration process automatically adds the Member role to all new users. Users I register 'quietly', just so they can download a document, wont be assigned the Member role, distinguishing them from normally logged on members.

Posted: Dec 9 10 at 17:13

View 1 Replies!   View Related
Web Forms :: How To Control Visibility Of Menu Nodes Depending On User Role
I have a Menu control in MasterPage based on web.sitemap file. My website has roles enabled (AspNetWindowsTokenRoleProvider)and uses Windows authentication mode. So, user has to be in a specific Windows Group to be able to access the site. I need to allow some users to see all menu nodes and some restricted set of nodes. How do I do that?

I would like to be able to create, say following Windows groups:

domain_namemy_app_users
domain_namemy_app_superusers
domain_namemy_app_admins

and code sitemap nodes this way:

<siteMapNode url="~/MOC_Masterdata_MOC_Approvers_Plain.aspx" title="MOC Approvers" description="MOC Approvers" />

Posted: Apr 16, 2010 09:27 PM

View 5 Replies!   View Related
Security :: How To Find Out If The Current User Is Elligible To View An URL Based On Role Provider
Iwant toexecute some logicif the Logged in User can view a page "~/MyPage.aspx". IF the logged in user should be elligible to view the page is determined by the role based security I configured in the web.config file. There are many methods to find out if the user is in role XXX or not. But I did not find any method to find out if the user can view a page or not ahead of transferring the user to that page. Maybe I will hide a link to a specific page to the logged in user if the user is not elligible to view that page if I know the technique i am asking here to know.

Posted: Aug 17, 2010 05:59 AM

View 1 Replies!   View Related
Security :: Adding User Role Selection To Create New User Wizard?
Im pretty much a newb when it comes to developing throuh ASP.net. I was wondering if there is a way to allow users who create new accounts using the "Create New User Wizard" through VWD to select the type of role they belong to, or do I have to build a custom extender to do that?

The reason for this is I want the end user to select what "Type" (Role) of user they are and then have their user role page load and store their personal information in that role's section of the back end sql database.

Posted: Aug 18, 2009 10:22 PM

View 5 Replies!   View Related
Security :: Creating A Interface For User Role Management Based On Built In Membership Provider?
I am creating a interface for User Role Management based on built in membership provider.I want to display all the roles as check boxes for a selected user. I am able to display all the roles in the database, but not able to load the specific user roles. For example, I am able to publish role 1 role 2 role3 role 4 as check boxes. But if the user is already flagged as role 1 and role 3, I am not able to show that data (role1 and 3 should be checked when form loads, but right now, they are not checked)...How do I get the roles as checked boxes display on a page.I am using a repeater control to display roles as check boxes on the page..

<asp:Repeater ID="UsersRoleList" runat="server">
<ItemTemplate>
<asp:CheckBox runat="server" ID="RoleCheckBox" AutoPostBack="true" Text='<%# Container.DataItem %>'

[code]...

Posted: Feb 18, 2011 01:12 PM

View 1 Replies!   View Related
Forms Data Controls :: How To Make Edit And Delete Button In Details View Control Visable Based On User Role
i am using detialsview control.here i have edit and delete button. i am using autogenerateitbutton="true" autogeneratedeletebuton="true"**now i have user role as **admin ** and *normal user*** in DB i table as user column roleID, **here "1" is admin " 2" is normal user"**if the role type is admin(1) then show both edit and delete button if the role type is mormal(2) user then dnt show these two button for noprmal userhow can i achive this functionlity done here in detialsview control**how can i get these controlID(i.e edit and delete button) in .cs file based on that i need to show the edit and delete button**

Posted: Nov 25, 2009 08:24 AM

View 4 Replies!   View Related
Security :: How To Create Custom Role Information Instead Of Using Built-in Role Database
Usuallyin sub-folder we will limit the access rightto some rolesandthis featurerequirespre-defined database schema.

However,if i still want to use this role featureof asp.net, but I do not like the pre-define database schema, I want to extract roleinformation from my own database table and bind it to the role.

Posted: Nov 13, 2010 02:22 PM

View 2 Replies!   View Related
MVC :: Dynamically Create The Route Based On The Users Selection?
I need to createa web page where the user can select from a variety of categories via a dropdown list, then enter a search term into a textbox to provide a search term. The category is going to dictate which controller to use, and the search term will be a query parameter for the List action of each controller.

What I can't figure out is how to dynamically create the route based on the users selection. How do I get the values selected from the dropdownlist and textbox into Url.RouteUrl?

Posted: Aug 18, 2010 04:45 PM

View 2 Replies!   View Related
Web Forms :: Dynamically Create Sitemap At Runtime From Menu Created From Db?
I have a menu of products which are created at runtime from the database and populated into menu control.

But i need to also create a sitemap and display when the relevant menu or submenu item is selected

Posted: Apr 20, 2010 02:55 PM

View 1 Replies!   View Related
MVC :: Dynamically Render The Usercontrols Based On The Logged In User?
We have an application where the controls are dynamically added to the form based on the logged in user,

This user controls related data is stored in the database.There is lot of logic in the code behind in the asp.net webforms which is so messy to maintain it, we are planning to re-writeit using the MVC framework.

I would say there would be rougly 50 different forms based on the user logged in, is it good idea to create so many views and redirect to the appropriate view based on the logged in user, in some of the forms there might be minor difference like the order of the Control might change.


Posted: Dec 01, 2010 11:42 PM

View 3 Replies!   View Related
Web Forms :: Load User Control Dynamically On Menu Bar Click
I am using 5 ,6 user control. I wanted to load diffrent user control on Click of menu bar. Means when I click on first link of Menubar 1 user control should load and 2 loaded when i Click on 2 link of menu bar. How to do that?

Posted: Jan 04, 2011 12:12 PM

View 3 Replies!   View Related
Security :: Dynamically Create Membership User And Check If User Name Is Valid Or Used?
I am createing user dynamially with the below code; string MyPassword = Membership.GeneratePassword(8,0).ToString(); Membership.CreateUser(TextBox7.Text, MyPassword, TextBox8.Text); but before I start creating, I would like to check if the user name is used before or not.

Posted: Jul 25, 2010 01:25 PM

View 2 Replies!   View Related
Forms Data Controls :: Dynamically Load User Control Based On The Count?
Im working with asp.net web application,I need to get multiple gridviews dynamically based on the count (which i get from database) for that i took a web user control and i added a gridview there . iwant to load that usercontrol in aspx.cs based on the count..

but im able to bind only one grid view...

Posted: Mar 17, 2010 05:35 AM

View 14 Replies!   View Related
Forms Data Controls :: Display Some Xml Tags In Gridview Dynamically Based On User Selection?
i have displayed a xml file in the tree view form by binding them....now i want a sample code to access the nodes which are being selected and to display dynamically in a grid view ..in asp.net/c#

Posted: Jul 17, 2010 06:48 AM

View 4 Replies!   View Related
Create A User Control Based In Gridview
I wont to create a User Control based in gridview that have the edit add delete incorporate,the problem is these:In the admin part of my web site i have to repeat the same action for view add delete update the data for different datasource.I wont to create a generic gridview that have incorporate these action.The gridview can take a xml file for configure him self dependently of the request for desplay the data.

Posted: May 10 10 at 6:50

View 1 Replies!   View Related
Web Forms :: How To Sign A Potential Member On Member Role With Create User Wizard
I have two member roles at my project:
1.) Administrator
2.) Member

From the toolbox in Visual Studio 2008, I have dragged and dropped the create user wizard into the stage. I aim that a guest can register itself and automatically join the "member" role. Not the role "administrator". How can I do that?

Posted: Feb 25, 2010 10:03 PM

View 9 Replies!   View Related
User/server Control With Custom List Items / Create A Simple Menu User Control
I'm attempting to create a simple menu user control just as outlined here.

The attached code results in an "Object reference not set to an instance of an object" error, but I can't figure out why.

<%@ Master Language="VB" CodeFile="MySite.master.vb" Inherits="MySite" %>
<%@ Register src="Controls/Menu.ascx" tagname="Menu" tagprefix="my" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">......

Posted: Feb 18 at 20:13

View 1 Replies!   View Related
Web Forms :: Create Menus Based On User Access?
I want to create a menu in a application i am building. I have 3 user roles defined in the database with menu items, navigation url and menu nesting level. I want to generate a menu based on what user logs in. I have the fetch the data from table based on user role. I am having problem in designing and binding the menu(dynamic).

Posted: Jan 20, 2010 08:55 AM

View 4 Replies!   View Related
Security :: Claims Based Authorization VS Role Permission Based Authorization?
Our team has recently implemented a role permission based authorization so that we can have granular control. This is similar to what Rockford Lhotka suggests herehttp://www.lhotka.net/weblog/PermissionbasedAuthorizationVsRolebasedAuthorization.aspxI have also read about the Claims based authorization which to me looks very similar to what we have. Can some one put in simple terms what the advantages of claims based authorization are.

Posted: Apr 26, 2010 07:35 PM

View 1 Replies!   View Related
Web Forms :: Create X Amount Of Input Filed Based Off User Selection?
Ihave form in ASP.Net 4 (C# backend) thata user fills out to enter a new game quote into my DB.I have created the form and this lets the user add only a single quote at a time, what I would like to do is give theuser a drop down box to let him/her choose to add up to 5 quotes at a time. The problem comes in how to generate the extrainput forms based on what the user chooses. I have been going over my ASP.Net 4 book but it really does notcover this.

Posted: May 15, 2010 02:46 AM

View 2 Replies!   View Related
How To Get Users Based On Role
How could users in a "customer" role be retrieved from a MembershipUserCollection?

Posted: Jan 24 at 6:30

View 3 Replies!   View Related
Create New Item In Table Based On Data In Controls When User Clicks On Button
I have a form free user feilds, some drop down which are populated by a database data and a button. I want to create a new line in a table when the user clicks on the button. the values for this new line will come from the Values (not visible content) of the drop box, the content of the text feild, the user ID that I should get from the connection and the current date... ie, I want do do a INSERT INTO table (userid, dropdown, text, date) values (how do I get the user ID from the session?, how do I get the value from the drop down?, how do I get the text from the text box?, how do I get the current date?)

Posted: Apr 27, 2010 06:53 PM

View 6 Replies!   View Related
C# - Implement Role Based Security?
How to implement role based security in each page.

Posted: Jul 11 10 at 15:50

View 2 Replies!   View Related
To Create A Name For The Cell/user Control Dynamically?
I have 5 cells on a page, and five references to a user control on a page, each one individually numbered, such as:

Chart1Cell.Visible = false;
Chart2Cell.Visible = false;
Chart3Cell.Visible = false;
Chart4Cell.Visible = false;
Chart5Cell.Visible = false;

and

Chart1.Visible = false;
Chart2.Visible = false;
Chart3.Visible = false;
Chart4.Visible = false;
Chart5.Visible = false;

What I would prefer to do is this: for (int i = 1; i <= 5; i++)
{
Chart(i)Cell.Visible = false;
Chart(i).Visible = false;
}

But I am not sure how I can create a name for the cell/user control dynamically. I am pretty sure I would need to create a name within the loop that equates to what I already have, just not sure how to or if it's even possible.

Posted: Sep 2nd, 2009, 07:54 AM

View 26 Replies!   View Related
Web Forms :: Create Web User Control Dynamically?
I want to know how can we create web user control dynamically.

Scenario: Basically i am developing registration user control. I have a web page(say,SelectInputs.aspx)that lists different types of fields along with checkbox attached to each of them for selection. Once i select desired input controls (which should appear inuser control) and click submit button then the file (.ascx) should be created from code behind.

eg: Lets say on SelectInputs.aspx i select fieldsviz. Firstname(textbox), Lastname(textbox), DateOfBirth(3 dropdowns) etc and click on submit button then from code behind the .ascx file should be generated that will include Firstname(textbox), Lastname(textbox), DateOfBirth(3 dropdowns) etc.

Posted: Mar 13, 2010 12:30 PM

View 4 Replies!   View Related
Web Forms :: How To Dynamically Create User Controls
how to create user control dynamically in aweb form ?When i am creating server controls of user controls are not instantiated and it is not getting initialized.when i am tyyingto initialize its properties error occurs thaobject instance not created .

Posted: Aug 25, 2010 08:51 AM

View 6 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved