ToString1
asked on
Code snippet to implement custom membership provider in ASP.NET MVC
I want to implement a custom membership provider in an asp.net MVC app. I am already using forms authentication and I have a simple database schema for membership/roles that comprises of two tables as only one user can be in one role.
Here are My table schema is in the code snippet below.
I currently check for a user's role by doing
if (User.userRole.roleName == "admin")////
But want to implement custom membership/roles so I need a code snippet that would implement the provider. T
Here are My table schema is in the code snippet below.
I currently check for a user's role by doing
if (User.userRole.roleName == "admin")////
But want to implement custom membership/roles so I need a code snippet that would implement the provider. T
USER
UserID Int
RoleID Int
Username varchar(100)
AreaID int
FirstName varchar(100)
Surname varchar(100)
Password varchar(100)
Email varchar(100)
CreatedOn datetime
ModifiedOn datetime
IsAuthorised bit
ROLES
RoleID int
RoleName varchar(100)
AREA
AreaID int
AreaName varchar(100)
ASKER
OK thanks
I am using linq to sql so would want something in that. I do not want to write stored procedures
I am using linq to sql so would want something in that. I do not want to write stored procedures
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK that is interesting
In my MVC app I am implementing forms authentication and nothing else
So with this post
http://mikehadlow.blogspot.com/2008/03/forms-authentication-with-mvc-framework.html
Can I implement role based authentication, ie, I want to partition off admin and superadmin parts of the app
In my MVC app I am implementing forms authentication and nothing else
So with this post
http://mikehadlow.blogspot.com/2008/03/forms-authentication-with-mvc-framework.html
Can I implement role based authentication, ie, I want to partition off admin and superadmin parts of the app
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Take a look at this:
http://developingmycloudapp.wordpress.com/2010/06/20/using-a-custom-membership-provider-in-an-mvc-application/