开发者

Basic "add user/edit user" forms authentication functionality in ASP.NET MVC

开发者 https://www.devze.com 2023-02-03 00:23 出处:网络
I want to use forms authentication on my ASP.NET MVC site. All I need is a place for users to login, a page to add a user, and a page to edit a user.

I want to use forms authentication on my ASP.NET MVC site. All I need is a place for users to login, a page to add a user, and a page to edit a user.

I'm using all the default ASP.NET forms authentication tables for SQL Server (aspnet_Profile, aspnet_Roles, aspnet_Users, etc.). The only difference is that I've added an Employees table to my database, which contains a FK to aspnet_Users to create a one-to-one relationship. The Employees table contains columns for FirstName, LastName, StartDate, etc. It's a way for me to keep additional information for the users.

I'm having trouble finding any sort of tutorial that would help me build a basic page in MVC, everything I find is for WebForms. For my page to add a user, I'd like there to be fields for the Employees table. I don't know if I can modify the CreateUserWizard to add those fields, or if I'd be better off just creating my own custom pa开发者_开发技巧ge.

Can anyone lead me in the right direction?


There are tutorials on ASP.NET MVC here:
http://www.asp.net/mvc

The "build your first" tutorial covers all the MVC basics, including authentication. Once you go through that, you can link your Employee tables to the Membership tables and you'll have learned how to deliver that data to an MVC View.


The MVC Membership Starter Kit is a good place to start: https://github.com/TroyGoode/MembershipStarterKit

0

精彩评论

暂无评论...
验证码 换一张
取 消