.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

asp.net,c#,user role and rights,menu

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :ASP.Net
hi friendsi want to develope general code or module or structure of web application wich handle multiple user ,their role and right, and according to their rights and role menu will be display.so i can integreate it in any website. kindly provide me solution for asp.net 3.5,C# working environment, and sqlserver 2005 environment.what is the structure for database? i want only one database not asp.net database. can i make login control type assembly(dll)?how?Thanking you 

View Complete Post

More Related Resource Links

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



how to store User Rights Information in asp.net



Please guide me how to store user rigths inforamtion in asp.net MVC Application

Here my User permission  information look like

UserID LoginID          UserName             Page  Permission     Role 

yahoo@yahoo.com Mohammed Askar Quote Edit                Admin 
yahoo@yahoo.com Mohammed Askar Quote Delete            Admin 
yahoo@yahoo.com Mohammed Askar Quote Verify             Admin


gamil@gamil.com   Mr. X                      Quote Cancel  &nbs

Need help with setting up SQL Server 2008 for role/user management


I've posted my problem in a few other categories.  Sorry for that.  I didn't see the security category until now.

I'm trying to use ASP.NET's built-in role/user management for a couple ASP.NET MVC 2 sites.  I'm using the MVCMusicStore as my guide.  I click on the Configuration Tool as the tutorial suggests, which launches the site administration page.  Unfortunately when I click on the security tab, I get an error that it cannot connect to the data store.  Attempting to test the AspNetSqlProvider gives me a similar error.

I've run the aspnet_regsql program as the error message suggested, and I have a role/user management database ready to go on the server.  The proper tables are constructed, and all that.  The configuration tool still doesn't see the data store.

As a test, I ran the MVCMusicStore demo in the debugger.  Its role/user management functionality worked.  I was able to add myself as a customer, and add/remove items from my cart with no errors or exceptions.  However, when I attempted to access its security tab in the configuration tool, I received the same error as I get for my own project.  How is it possible that role/user management works, but the configuration tool cannot change its settings?

Any suggestions on how I can get the configuration t

sitemap control user rights enable and disable



iam using masterpage and sitemap in my project, what i want to is that

if user login is did, based on the user previlage in need to show the sitemap menu page

if user i have the previlage to see the page then i should enable that page otherwise

i need disable that page

looking for the valuable suggestions

Tighten rights for DBCreator role

This is a long posting, please read it through and then give me your thoughts on the subject or your experiences. I have a SQL Hotel, I e lots of databases 'rent' room on my clustered hotel. Whenever a new project needs a database it's up to me to make that happend. If the database is created by some install program and user is hardcoded as SA, then I run against a temporary SQL server, then I move the database, users, jobs and endpoints, if they exist to the SQL Hotel. But if the program allows me to choose user myself, then I would like to let it install against my cluster live (no I dont have a sufficient test environment, getting there slowly). If I grant a account (domain and SQL) the dbCreator role, it can drop ANY database. This is in my opinion not acceptable. Im thinking about creating a trigger like: DDL Trigger, unfortuantly fires after drop database command, but something like this... If user is member of sysadmin, then Return (exit trigger do nothing), else rollback, check DBO of the database, if user is DBO, disable the trigger and drop the database again, otherwise let the drop database be rolledback and log the event to eventviewer. Two drawbacks, I cannot suppress the message that it's not deleted (need a rollback to check weather DBO in the database is the account issuing the drop), so I will have to construct two messages, both explaining that the first

User rights

Hi,I want to give rights to a user on workgroup to access a computer on a domain. The computer in a workgroup and server on a domain are part of a network. What rights should I give so that I can access that computer. Please also know that I need it for impersonation. My webserver is on a workgroup, however the file server is on a domain. I want to access the files on the file server from my application on webserver.I have tried number of things. May be this might work.Thanks.

Need to set "ValidateRequest" on the basis of user role

I am trying to implement a code which will switch Validation request on the page on the basis of user role. If accessed by power user, it should allow html entries in textboxes otherwise restrict. I want to implement something like below..I would really appreciate if proper idea/code is shared. if (Page.IsPostBack == false) { if (Session["userrole"].toString()="admin" { SetValidateRequest(false); // Sample Function to set validation } else { SetValidateRequest(true); // Sample Function to set validation } }  

infopath 2003 user role error

hi, i'm trying to create a user role for my form in infopath 2003. but when i add a user and click on the icon next to the texbox it gives me this error: The program cannot open the required dialog box beacause no locoation can be found

user mapping to a database and role membership to that database

When assigning a 'user mapped Login' to a database and role membership to that database, is it redundent to check/enable db_datareader, db_datawriter as well as db_owner or will check/enable db_owner become all that is necessary to provide role membership to the database?

user role on sharepoint custom list

hi, can i set up a user role for a custom list form in sharepoint services 3 i want to use the "submit new absence" form. but i need to modify the form in a way that when a user open the form it fills the user his name or login name in the fields. and that the approver or "assigned to field" also is filled with the approvers name. i think i need to use a query for that, but how can i apply it to the fields of the absence list form

Changing a users role with RadioButtons (User is always in single role)

So I have a set of 5 radio buttons corresponding to the roles a user can have on my website.  I have been successfully able to retreive what radio button needs to be checked for the role the user is currently in... string username = Request.QueryString["username"]; // Get Access Levels and populate radio buttons. if (Roles.IsUserInRole(username, "Banned") == true) { RadioButton4.Checked = true; } if (Roles.IsUserInRole(username, "Member") == true) { RadioButton1.Checked = true; } if (Roles.IsUserInRole(username, "FOB_Employee") == true) { RadioButton2.Checked = true; } if (Roles.IsUserInRole(username, "FOB_Administrator") == true) { RadioButton3.Checked = true; } if (Roles.IsUserInRole(username, "Webmaster") == true) { RadioButton5.Checked = true; } My problem is I do not know what to do with the actual procedure of changing the roles based on the new radio button selection.  I have tried many different methods, including using if statements to check if the user is currently in the role, remove him/her from that roll, and then add the user to the newly selected role.  It appears, from my testing, that you can not

User rights stripped on subsites

Hello, I create a subsite, select  "use unique permissions", and create the accessgroups: visitors, members and owners.  I then enter som testusers in the visitors and members-groups, log on as them to make sure the testusers have the correct access-levels.  I also make sure my newly created access-groups are the only groups with access to the subsite.  20 minutes later, the testusers no longer have access to the subsite.  What kind of service running on the server would strip these rights?  When I log on with the owner-account, I can still see the testusers in the correct groups, but they no longer have access.  Anyone else with the same problem? I'm hoping for some good suggestions! Thanks, Kjersti

CreateUserWizard creating dupicate user while assigning Role.

protected void CreateUserWizard1_CreatedUser(object sender,  EventArgs e){Roles.AddUserToRole((sender as CreateUserWizard).UserName, "Customers");} CreateUserWizard is creating dupicate user while assigning Role.How can we assign Role without duplicating user record? I've observed ApplicationID for assigning Role is Differenent than Creating New User, so when ever Role assigning comes in, it creates  same user again with new UserID. Is it related to Web.Config in some way? As when I try to create user from "VisualStudio/Website/ASP.net Configuration" even then two users with same usernames are entered in aspnet_users with Different ApplicationID and UserID. One user has Role and another duplicate user is without Role status of IsApproved=1.Please help me to resolve this issue.Thanks!  

Menu - Role security not working on second level of sitemap


I have role assignments on both the first and second level of my menus within my sitemap file.  The first level works fine, and I only see items assigned to my role.

But roles assignments seem to have no effect on the second level.  It seems like if you have access to the first level, you have access to everything on the second level.

Is this correct?

From my sitemap (either a SalesRep or an Administrator can see everything underneath):

    <siteMapNode title="Administration" roles="SalesRep,Administrator" description="Admin" >

      <siteMapNode title="CompanyMaintenance" roles="SalesRep" url="~/Admin/CompanyManagement.aspx" />

      <siteMapNode title="Initialize Roles" roles="Administrator" url="~/Admin/Roles.aspx"/>


From my config:

    <roleManager enabled="true" defaultProvider="SqlRoleProvider">

ScaffoldTable(false) if user is not in the admin role.


Hi guys,

I my dynamic data application, I made ScaffoldTable(false) on some of the table in a seperate partial classes. I am using linq to sql classes for my tables and Also I am using sql membership on my application.

what I want to do is that I need to make the following table's ScaffoldTable as false, if the user is not in the admin role. How can I do that ?


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Configuration;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Xml.Linq;
using System.Linq.Expressions;
using System.Reflection;

/// <summary>
/// Summary description for CategoriesPhoto
/// </summary>

public partial class CategoriesPhoto
public class CategoriesPhotoMetaData


Fine-grained User Permissions, create and view with restricted edit rights


I'm running a Sharepoint 2007 installation which is slowly being rolled out through the organisation. We have a group of calendars which are shared between 14 executive PAs. I've been asked to lock down the permissions so that whilst any of the users can add items, only the user who created the item can subsequently edit this. I thought I could handle this by creating a new permission level with create and view rights only, which does what it should, however the user can now no longer edit their own appointments either.

Is there a way that I can give the item creator specific permissions on their item by default?

Restrict user with sys admin role to execute a query


Hi All


I want to restrict  a user with sys admin server role to execute a query. or is there any possibility to drop the query before it get executed (after parsing). I know i can do this using SSMS SET NOEXEC ON | OFF in Query Analyzer.

But how can i implement this when ever sysadmin user executes a particular query.


Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend