Web Forms :: Add "role" Parameter / Property To User Control Containing LoginView Control To Set "Role" Possible?

Jan 13, 2010

I am in the process of creating a user control that enables content areas of our web application to be editable. The control utilizes the asp.net membership/role providers and incorporates a LoginView that only displays the edit link if a user has logged in and is a member of the desired role. What I would like to be able to do is pass the "role" as a property of the control so it can be set dynamically and does not have to be hard coded into the control if I use elsewhere in another application.

View 3 Replies


Similar Messages:

Security :: Displaying Role-Specific Markup With The LoginView Control?

Oct 14, 2010

I want to know how can I display role-specific markup using loginview?

I have these three roles, Admin, Editor, Moderator

Each and every user will belog to only one of the following role groups

1. Admin, Editor, Moderator (Some user/s will have all these three roles)
2. Admin, Editor (Some user/s will have all these two roles)
3. Admin, Moderator (Some user/s will have all these two roles)
4. Editor, Moderator (Some user/s will have all these two roles)
5. Admin (Some user/s will have all only this role)
6. Editor (Some user/s will have all only this role)
7. Moderator (Some user/s will have all only this role)

Now I want to display some links that will be specific for each role group to which one or more users will belong. So the links I want to display for these role groups are following

1. Admin, Editor, Moderator => Only Links of all the pages of Admin, Editor and Moderator
2. Admin, Editor => Only Links of all the pages of Admin and Editor
3. Admin, Moderator => Only Links of all the pages of Admin and Moderator
4. Editor, Moderator => Only Links of all the pages of Editor and Moderator
5. Admin => Only Links of all the pages of Admin
6. Editor => Only Links of all the pages of Editor
7. Moderator => Only Links of all the pages of Moderator

I have tried doing this using RoleGroups in Loginview but couldn't succed.

Can anybody let me know the correct way of going this?

View 13 Replies

Web Forms :: How To Control Visibility Of Menu Nodes Depending On User Role

Apr 16, 2010

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" />

View 5 Replies

MVC :: Strongly Typed User Control On All Pages Based On Login Status And User Role

May 9, 2010

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.

View 3 Replies

Authentication - How To Limit .net Control Actions Based On User Role

Mar 12, 2010

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?

View 3 Replies

C# - How To Set User Control Visibility, Upon User Role

Mar 11, 2011

I want to implement access control for usercontrols depending on user role(s), I want to do it on the control base class, in such way that on every user control I only need to set a string with allowed roles to see the user control

This is how an user control class may look like:

public partial class SimpleMenu : MyUsrControlBase
{
protected void Page_Load(object sender, EventArgs e)[code]...

How to set up user control visibility from the base class depending on the validation result?Also which event in the user control is the best to set the roles?

AlloweRoles = "RoleA, RoleB"

View 1 Replies

AJAX :: What Is Role Of Scriptmanager Control And Updatepanel Control

Jan 7, 2010

What scriptmanager control and

updatepanel control role if we add this control to web page

and when we use triggers with update panel control.

View 2 Replies

Security :: How To Create Custom Role Information Instead Of Using Built-in Role Database

Nov 13, 2010

Usually in sub-folder we will limit the access right to some roles and this feature requires pre-defined database schema.

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

View 2 Replies

Web Forms :: SqlDataSource Control Parameter Property Name For File Upload Control

Mar 27, 2010

I'm using SqlDataSource to update image stored in the database. Everything is working fine using the code below but I don't know how to access the Property Name to get the content type of the image. How can I have the pass the File upload's content type to the parameter @imgType?

[Code]....

View 1 Replies

Security :: Sql Role Provider Does Not Allow To Update The Role Name?

Mar 18, 2011

Why asp.net sql role provider does not allow to update the role name , whats its reasons.

View 5 Replies

Security :: Login Control And .Net Membership & Role?

Oct 28, 2010

I am currently working in an ASP.Net application where i need to implement ASP.Net Membership and Roles. I have used Login controls in my pages. Also I am using a menu in the master page, which is getting data bindings from database. For data bindings I am using XMLDatasource and a transform file (.xslt file). I need to bind the data to the Menu based on the user roles.

My issue is that the generated Menu is not behaving consistently. Sometimes it will show the correct menu for a particular role and some times it will show previously loaded data.Providing my code here:

masterpage.master.cs
private void LoadMenuItems() {
System.Security.Principal.IPrincipal User;
User = System.Web.HttpContext.Current.User;[code]....

View 7 Replies

Security :: Single Login Control With Different Destination Pages By Role

Feb 16, 2011

I am using visual stuido 2010 and vb. I am trying to direct users to one of three different pages upon sign in, depending on their role. Basically I have three roles: administrators, dealers, and customers And three respective destination page urls: admin/default.aspx, dealer/default.aspx, and customers/default.aspx. Everything I can find in the forums is in C. So far I have nothing, so I guess I'm asking someone to write the whole sub for me. I wish I was more proficient, but I'm working on it.

View 4 Replies

Web Forms :: Accessing A Public Property Of A Nested User Control In A Master Page From A Pages' User Control?

Sep 10, 2010

I've got a web site that has a master page and that master page (mpMaster that has a user control ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page
and on this page I have another user control (ucPageControl), I need to find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all?

View 5 Replies

C# - Can Set A Role Description When Adding A New Role

Nov 3, 2010

When adding a role (making use of asp.net's role provider), i cannot find a method to add a role including a description.the asp.net Role table in SQL makes provision for a role description, however the only method available is:Roles.CreateRole(string RoleName);here is no overload to include a description.Is there an out of the box way of including the description? or should i go about this myself?

View 1 Replies

Security :: Control Button Display On The Page By Unknown Role Which Is Created By Customer?

Apr 9, 2010

I would like to use the asp.net membership and role management. However, all I found is fixed role control on the page level. Is there a way to let customer (administrator) to create their own roles, and assign the permission (edit, add, or view) to them, and then, use the permission to control te display (for example: edit button visible or not)?

View 5 Replies

Security :: Role Membership Returns The Error : The Parameter 'username' Must Not Be Empty?

Jul 16, 2010

[Code]....

returns the error: The parameter 'username' must not be empty.Parameter name: usernameI want to check if a user is logged. If not logged in redirect to loginerror.aspx.

View 9 Replies

Web Forms :: How To Show A Panel If A User Is In A Role

Sep 22, 2010

I'm trying to use the following code to show a panel if the user belongs to a group:

protected void Page_Load(object sender, EventArgs e)
{
panEditor.Visible = (this.User.IsInRole("Administrators") || this.User.IsInRole("Editor"));
}
}

This is not working. It errors with "...does not contain a definition for 'User'...

View 10 Replies

Web Forms :: Set Button Property In A User Control From Another User Control

Mar 22, 2011

i have 2 user control : uc1 and uc2. and i have button in uc2 i call button1, i want to set commandArgument of button1 from uc1, how can i do this?

View 5 Replies

Passing Parameter From One User Control To Another User Control In An Aspx Page?

Jun 3, 2010

have two user controls on one aspx page. UC1 has a grid which contains a link button column which user clicks. Based on the value of clicked cell, I need to show some data into UC2.How do I pass data from UC1 to UC2? How do I invoke a function of UC2 from UC1?

View 2 Replies

Security :: Enable User To Edit / Delete Based On User's Role Permission

Feb 24, 2011

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 = "SELECT USERNAME FROM Users LEFT JOIN UserList ON UserList.GM_UserName=Users.UserName WHERE UserList.Department ='Dept XYZ'"

I'm able to do this.

If Session("Userid") = "TestUser1" Or Session("UserID") = "TestUser2" Then Do this Else Do that End If
BUT unable to do this...
If user's Department = 'Department XYZ' Then
Do This
Else
Do that
End IF

View 2 Replies

Security :: Get The Role Id Rather Than The Role Name?

Feb 10, 2010

How can i get the role id, rather than the role name?

For instance with the code below

Dim roles1 As String() = Roles.GetAllRoles()
GridView1.DataSource = roles1
GridView1.DataBind()

I can access the role name in the gridview like below, but how could I get the ID to pass in a hyperlink?

<asp:Label ID="lbl1" runat="server" Text='<%#Container.DataItem.ToString() %>' Visible="false" />

View 1 Replies

Security :: How To Get The User's Role

Jan 22, 2011

Is there any way that I can find the exact name of the role a User is in? There is a property for UserName ( User.Identity.Name) but what about the role?

View 1 Replies

How To Add User Role Using MS Access DB

Jul 18, 2012

trying to get a login script working, its working fine, but now i have a new problem, i have a field im my DB thats called "urole" in that i have 3 roles, Admin, Co-Admin, User.

How can i use something like this on a page.

Code:

If Roles.IsUserInRole("Admin") Then
Label1.Text = User.Identity.Name + " is an Admin"
Else
Label1.Text = User.Identity.Name + " is NOT in an Admin"
End If

I have this script on my login page

Code:
Imports System.IO
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Configuration
Partial Class DbLogin
Inherits System.Web.UI.Page

[code]....

and then i have this on my default page, thats shows the info from an user, now i just want to show the role (urole) and then use an "If Roles.IsUserInRole" event so i can show some diffrent thing if admin, co-admin or User

Code:
Imports System.IO
Imports System.Web.Security
Partial Class _Default
Inherits System.Web.UI.Page

[code]....

(The aboved is working fine, but its not showing the urole/Role of an user)

View 12 Replies

User Controls :: Show Hide Specific Section Of Page Based On User Type Or Role

May 7, 2015

I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here.

View 1 Replies

Security :: Why A Forms-authenticated User Needs To Login Again To Role Subfolders In An IIS Server Environment

May 7, 2010

Followed the code sample of Chapter 10 (Logging in) of the Book, Microsoft ASP.NET 2.0, I created an ASP.NET 3.5 website with Forms Authentication. The sample code used Website Administration Tool (WAT) to manage the users, roles, and authorization.When running in the ASP.NET Development server environment, I can first login, then click to open the links for each for the 3 roles.

However when running the sample code in the IIS server environment, I can login but can not open the links for the role subfolders.Clicking each link popped up an error message for opening a login.aspx from the specific subfolder. I don't have a Login.aspx file in each subfolder.The 3 role subfolders were configured as the virtual folders in the IIS Server. Why the sample code worked fine inASP.NET Development server environment, but got an error message from theIIS Server environment? Why an authenticated user can not open the subfolder homepage?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved