.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

New to MemberShip and Roles

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

Hello all professionals !  My Problem is different. I want to implement the roles and membership feature in my website. The problem is that i want to use it in my own way. I dont want any kind of security question and answer and the password and user ID is also generated automatically in my website registration form according to client need. but the problem i am facing is i dont know how to implement membership and roles feature on remote sql server database. i have a connectionstring written in web config. I dont want to use the default databse automatically generated by visual studio. I want to use the Database designed by me. it has its own columns and properties. I want to customize create user vizard also. I am using roles and membership only because i provide more efficient way to handle bulk coding. 

 What i want to do is just store registration information in remote databse using create user wizard and through membership. and also create user wizard will be customized.


Any Help would be apppreciable. PLZZZZ

View Complete Post

More Related Resource Links

FileUpload Control with membership and roles


Hi Everyone!

I'm pretty new to development using Microsoft technologies.

I'm trying to build a portal kind of an application in asp.net, in which one of the functionality is letting people log in and upload their documents. The upload page is only accessible to registered users of the portal.


I would like to track the user uploaded files according to their userIds.

Is it possible to use the FileUpload Control and C# to fetch the current user id, create a directory with the same name(as that of userID) in the file system and upload the files( multiple file upload, if necessary) into it?

Also another admin page would have to be able to see the list of files uploaded by the specific user and download it if necessary.

Could anyone help me with this?

I'm also expecting alternate solutions to the problem.

Awaiting a response.

Thanks in advance 


Multiple groups of roles in membership

Hi,I am developing this website which requires multiple groups of roles inside membership.Here is an example:I want to create a group of states (would be the first group of roles):* Oregon* California* Kansas* Texas* OhioAnd then a second group of profiles:* Admin* Section 1* Section 2* Section 3Then I want to comine these groups, so for example:* Patrick has Oregon and Section 1 role, so he can only access the state of Oregon and Section 1 module on the website.* Laura has Kansas and Section 2 role, so she can only access the state of Kansas and Section 2 module on the website.* John has Ohio, Texas and Admin and Section 1 roles, so he can only....Do you understand what I mean? How can I achieve this with .net memberhip?

Check membership roles

Hello All, I have the following, for an webapplication I user membership roles. Users are added or removed from a role. I have two things i am wondering how to accomplish.   The first: New or exisiting users have assigned roles for their accounts. This roles can be selected or deselected from a checkbox (when the users is created or edited) . I want to build some routine or function to see if a users is part of a role or if he is assigned a new role. When, in edit mode, a users is part of a role the particular checkbox has to be checked, or if he isn't unchecked. Of course I want to call a function to do that so I don;t have to write the if then statement for all roles, but just one time. I think this should be a public function to call from all pages within the appication, but whatever i try, it doesnt work.  I have written a function in a apart classfile called functions.vb. But the roles syntax isn't recognized. Herby the function{Public Function CheckMembership(ByVal GroupName As Boolean, ByVal User As String, ByVal Group As String) As Integer If GroupName = True Then If Not Roles.IsUserInRole(User, Group) Then Roles.AddUserToRole(User, Group) ElseIf GroupName = False Then If Roles.IsUserInRole(User, Group) Then Roles.RemoveUserFromRole(User, Group)

how to customize asp.net membership roles to create separate member area ?


I am using asp.net membership for all the users and roles, right now i have a website on which i have created 2 roles "admin" and "member"

in this website i create accounts, so all the accounts are separated/distinguished by account name

now i was to add one more role "accountholders" and i want to add this role in such a way that an account holder will be able to see his / her account's stuff ...

i as admin will be creating username and password for accountholders and i will provide them their login credentials so that they can login and see what's in their account.

My idea of creating account is that, the accounts that i have in my database will be the key, so when i will create username for particular account , in the create user wizard i should have a drop downmenu will all the accounts name. so the user that i am creating will be linked on that account only ..

how to accoplish this ? please guide me in a right direction...

profiles, membership and roles


Dear All,

Can someone help me with creating a custom profile, membership and role page something like this:


I'm trying to edit this as my requirment but I can't make it work. I will just need to add detailview to view the entire profile since it's to long for the gridview to handle.

I need to display the gridview custom data then by selecting the select, it will be displayed on the detailview to edit and delete. In create user, need to add my data requirement by making a createwizard page on the left table same as the link. 

IIdentity, IPrincipal, membership and roles provider



How I must use this? I create custom principal for implement logic for users. In identity I store Id, Name. But it abnormally - this classes must use for authenticate and authorize. 

I can implement custom MembershipUser, custom Roles and Membership provider. 

IIdentity, IPrincipal, membership and roles provider



How I must use this? I create custom principal for implement logic for users. In identity I store Id, Name. But it abnormally - this classes must use for authenticate and authorize. 

I can implement custom MembershipUser, custom Roles and Membership provider. 

How to do it? What best practices are?

Best regards,

Peshkov Evgeniy.

Do Membership Roles work with custom connection string?


Hi all, plz help with one issue.
I have Membership configured with IIS7, tables for it located in my own database, created with aspnet_regsql utility, and I am using custom connection string to access it.

This is part of web.config related to Membership :

        <add connectionString="Server=CORESERVER\SQLExpress;Database=Shop;User ID=Tema;Password=Matrix" name="CustomSqlConnection" />
    <profile enabled="true">
            <add name="CustomSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="CustomSqlConnection" />
    <roleManager defaultProvider="AspNetSqlRoleProvider" enabled="true">
            <add name="CustomSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="CustomSqlConnection" />
    <membership defaultProvider="CustomSqlMemberPr

How to use ASP.NET's Membership, Roles etc. in asp.net 4.0?


Good morning everybody.

I want to practise ASP.NET Authentication, and Authorization features in Visual Studio 2010.

I wanted to store user account information NOT IN THE aspnet db, but in a SEPARATE database. Hence, I have tried to use aspnet_regiis tool at visual studio command prompt. I am not presenting with wizard type window. Without wizard, I don't know how to store user information in a separate database otherthan aspnet db.

Can anybody please suggest any solution for this.

Also, one more thing:

It looks like lot of features have been changed in Visual Studio 2010 to work with Forms Authentication. If it is really changed, can anybody please suggest me the better resources to learn on the web?

Thansk in advance,
Ashok kumar.

Roles.GetAllRoles() And Membership.GetAllUsers() Not Working.


Hello Forum,


I have been attempting to load my users and roles into a couple of listboxes but for some reason the listboxes are showing up empty.  What am I doing wrong?


<%@ Page Language="VB" MasterPageFile="~/PEPMasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script runat="server">

Dim rolesArray() As String
Dim users As MembershipUserCollection

    Public Sub Page_Load()

        Msg.Text = ""

        If Not IsPostBack Then
            ' Bind roles to ListBox.

            rolesArray = Roles.GetAllRoles()
            RolesListBox.DataSource = rolesArray

            ' Bind users to ListBox.

            users = Membership.GetAllUsers()
            UsersListBox.DataSource = users
        End If
    End Sub

Public Sub AddUser_OnClick(sender As Object, args As EventArgs)


Membership and roles in ASP.net 3.5



I would like to know about roles in asp.net.Actually I am using VS2008 and SQL Server 2008.

Here I have to implement admin,L1,L2,Employee roles and their access assign by admin.

Here all machines are in network.I have also limited access.

I want to implement roles only for stand alone PC. Please advice the better way.


Help in Membership schema and roles


hi all,

i am making a website when i m almost 25% my manager told me to add roles and stuff...my problem is how to make roles in nested manner.

my website has Admin and users(admin, area manager, site manager, user) and then on the default page i need to disable enable buttons according to companies e.g starbucks should not access accident modules etc etc

so i am really confused how to make roles in nested manner. any assistance is welcome

thanks in advance

WCF and ASP.Net Membership, Roles and Profile



I have a client asp.net website that uses  ASP.Net Membership, Roles and Profile providers and Login controls.

I need to expand the application so was going to use WCF Workflows, the ASP.Net website will be hosted on a different server than the WCF Services so what I want to do is get the ASP.Net Website to auth via the WCF Service.

So process will go:

ASP.Net Website ------------------> WCF Service ------------------> SQL Database (Membership, Roles, Profile, Workflow Persistence Data and Business Data)

I tried creating a custom Membership and Role providers but I have had problems managing the users (Membershipuser class) saying null when a vaild user has been return by the WCF Service as can access the properies but not the methods.

Am I doing this the right way or is there other built in classes that I have missed?


ASP.NET forms authentication with roles

.A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored.
.A protection method is specified for the cookie.
Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath

Hard Code Roles on the Pages


If i hard coded role=Manager on the specific SiteMap/Folder/Page/etc. I will have problem when the manager need to remove from access a specific page. I need to change the code ont eh page/SiteMap/Folder more move the file into another folder.

What i have in mind is to change the role to taks oriented. such as role=AddStock, Edit Stock, Delete Stock, Print DO, Add Sales, Edit Sales, Deleted Sales..... (but it will be many role for 1 user compare to just 1 as Manager)

Will this cause performance issues later when each user have 60 roles and if i have 20,000 user will it affect the application performance?

Otherwise any other option? to make it flexible.

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

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