i'm supposed to create a ASP.NET MVC 3 Web Application with a login. The login shuould be for different user (member, admin..). I'm using Visual Studio 2010 ultimate and MS SQL Server Management Studio. I created a database with two tables "user" and "roles"
and created a one-to-many relationship between "user" and "roles". the Database is saved local and created in MS SQL Server Management Studio.
My first question is: How can i get the database connected with my web application?
But i have to make a difference between the roles. Like the "members" can just see the homepage and the "admins" can see the homepage and also see a page where sey can add/change users?
How can i make it different view for different roles?
ChristinaBu
Member
2 Points
7 Posts
ASP.NET MVC 3 LOGIN
Apr 20, 2012 09:47 AM|LINK
HI,
i'm supposed to create a ASP.NET MVC 3 Web Application with a login. The login shuould be for different user (member, admin..). I'm using Visual Studio 2010 ultimate and MS SQL Server Management Studio. I created a database with two tables "user" and "roles" and created a one-to-many relationship between "user" and "roles". the Database is saved local and created in MS SQL Server Management Studio.
My first question is: How can i get the database connected with my web application?
kedarrkulkar...
All-Star
34305 Points
5520 Posts
Re: ASP.NET MVC 3 LOGIN
Apr 20, 2012 09:52 AM|LINK
check this article... wher I have explained creating simple form authetication in MVC
http://www.bluelemoncode.com/post/2011/02/13/Creating-custom-authentication-form-in-MVC.aspx
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
ChristinaBu
Member
2 Points
7 Posts
Re: ASP.NET MVC 3 LOGIN
Apr 20, 2012 11:01 AM|LINK
your article is great.
But i have to make a difference between the roles. Like the "members" can just see the homepage and the "admins" can see the homepage and also see a page where sey can add/change users?
How can i make it different view for different roles?
kedarrkulkar...
All-Star
34305 Points
5520 Posts
Re: ASP.NET MVC 3 LOGIN
Apr 20, 2012 11:17 AM|LINK
in addition, you should have another table to store membership information... of roles and users and its model class
get the membership information for specific user in LogOn action...
if the user is valid role... then display add/change users link else not
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site