.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

Extending Role/Membership

Posted By:      Posted Date: August 25, 2010    Points: 0   Category :ASP.Net

Given an organization site, here is what we need to accomplish:

  1. Administer Role/Membership completely on specific pages of the remotely hosted site instead of using a local site within Visual Studio.
  2. Create and add region group, city group or other groups in addition to the basic user group. How can the new groups be stored and administered?
  3. After users login the 1st time, their Role/Membership are saved so that they will be redirected to their own designated page upon future login. Are we going to use cookies and/or tables to store related data?

Please advise how to best implement the above with samples and/or tutorials.

Thanks much in advance.

View Complete Post

More Related Resource Links

Membership & role management in asp.net..

hi..am switched from windows application to web application i want full application  of Membership & role management (Dynamicaly create User, role,members .....)if available please inform me or give me information how to create application steps

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?

Extending membership tables


Any reason not to add fields to these tables, or is this just as easy as creating tables to join to aspnet_roles and the like?


Migrating ASPNET Role/Membership Database to New Server



I have an existing ASPNET role/membership database created on SQLExpress 2005 (WIndows 2003 Server). I created it under the .NET 3 framework many years ago using the aspnet_regsql.exe application in full GUI mode. 

I am setting up a new Windows 2008R2 server with .Net Framework 4 and SQL Server 2008R2. I don't want users to have to recreate accounts or create roles, etc.


1. Should I backup the current database and import it into the new system, and if so do I even need to use the aspnet_regsql.exe application. (If so which version do I use, different aspnet_regsql.exe files exist in different directories (i.e., FrameWork, FrameWork64)

2. Should I just run aspnet_regsql.exe on its own and then somehow try to import the current data into those tables.

I am concerned that if I just import somehow the roles within SQL server will not be created properly. 

thanks in advance,


Setting Membership/Profile/Role provider's connection string at runtime...?


How can I set the connection string for the built-in membership, profile and role providers at runtime?

Since each site in our multi-site application uses a separate API to retrieve its specific connection string (via key, for security purposes), I cannot set the connection string to my providers in the web.config file. I need to be able to set the connection strings programmatically at runtime, but I cannot find how to implement this.

I thought many people must have run into this problem, but I can't seem to find anything regarding this.Can anyone here help me with this problem?



Multiple Role Membership



I need to populate a dropdown list with users who match certain role criteria. For example, if I have the following roles: Manager, Employee, Supervisor I would like to populate the list with only the Manager and Employee roles. Some individuals have multiple roles and they should be excluded if they also have the Supervisor role as illustrated below:

Name: A , Role(s): Manager, Employee, Supervisor

Name: B, Role(s): Employee

Name: C, Role(s): Manager, Employee

The final list should only contain names B & C.

I can use Roles.GetUsersInRole("Employee") but I am not sure if this is efficient or not.

thanks in advance,


Using custom Membership/Role providers for WCF?


I'm currently trying to get the hang of WCF services and build a few test services that do a few dummy things(like a game's highscore service, where you can submit a high score to, get the list of top 10 users in it, get your position in the list and create a new account).

This is all still very basic stuff, since WCF is overwhelming me. What I want to do is write my own custom little username/password store because the default asp.net membership provider is way to complex for me. However, since I intend to write services that do make use of roles when calling it, I decided to add an extra little layer to it, and add in user roles as well. When a user is an admin, it can retrieve the high score list and delete items from it. So, this would result having only 2 roles(submitter / admin).

However, I am completely lost on how to implement it. I've used the Membership stuff before in asp.net, but never wrote my custom version of it, and I'm not even sure if I need to use that. Can anyone shed some light on the situation here?


Membership / Role Provider Problems with Connector NET 6.3.5


I'm building a website using VS2008 Pro, Win XP Pro, MySql 5.1 and Connector 6.3.5. My connection to the database seems to work fine when I attempt to pull data from tables to build pages but when I try to create users for the website using the create user wizard I get the followin error:

Access denied for user ''@'localhost' (using password: NO)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Access denied for user ''@'localhost' (using password: NO)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[MySqlException (0x80004005): Access

Login Control and ASP.Net Membership & Role


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:


private void LoadMenuItems() {

System.Security.Principal.IPrincipal User;

User = System.Web.HttpContext.Current.User; 

string appName = HttpContext.Current.Request.ApplicationPath;
string username = User.Identity.Name;

DataSet menuSet = new DataSet();  

xmlDataSource.Data = null;

menuSet = GetMenuDetails(appName, username);

menuSet.DataSetName = "Menus";

menuSet.Tables[0].TableName = "Menu"; 


Does the application name property in sql membership provider and role provider has to be the same?



For my FBA authentication I have membership provider application name as 'x' and role provider application name as 'y'.

My FBA login form is authenticating users that belong to application 'x' in aspnetdb database, and not application 'y'.

could anybody help me with this..




Database Role membership for MSDB database alone



           I do like to find the query to list out all the available database role membership identities for msdb database. For other database i pull out the list of database role membership from sys.database_principals whose principal_id ranges between 16384-16393. For msdb database there seems to be much of database roles and it is not available in sys.database_principals. Kindly help me out in pulling out all the database roles for msdb database alone.




Business Modelling and Web Applications and extending UML

UML can be used to model a business, prior to automating it with computers. The same basic UML syntax is used, however, a number of new symbols are added, in order to make the diagrams more relevant to the business process world. A commonly-used set of these symbols is available in current versions of Rational Rose.

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?



Multiple membership providers



In my web.config I have:

        <add name="ADProvider1"
        <add name="ADProvider2"

If I just have ADProvider1 it works, when I add ADProvider2, even though for testing I only use ADProvider1 I get an error: "Unable to establish secure connection with the server"

Am I adding the second provider to the membership section incorrectly?



Replacement options for Membership


Hi everyone,
     I tried to use Microsoft's Membership option for signing up new users and authenticating them on subsequent pages, but it has not worked very well. The biggest issue has been with the REMEMBER ME function. With this checked, I am randomly logged out in the middle of some functions and some pages always show me as not authenticated, while others properly show me as authenticated. I built a site based on VB.
I was wondering what other people are using ro register users and monitor authentication and also if anyone has had better experiences with other solutions. 

Hi everyone,

     I tried to use Microsoft's Membership option for signing up new users and authenticating them on subsequent pages, but it has not worked very well. The biggest issue has been with the REMEMBER ME function. With this checked, I am randomly logged out in the middle of some functions and some pages always show me as not authenti

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

Membership Search user


Is there a membership function to search a username Like this:   LIKE '%UserName%' ?

This is not working.

MembershipUser User = Membership.GetUser("%" + TextBox1.Text + "%");

Thank you.

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