如何在mvc中实现登录机制? [英] How to implement login mechanism in mvc?
问题描述
我想开发一个asp.net MVC4应用程序,并希望实现自定义登录机制,
之前我使用的是asp.net网页表单,现在正在迁移以MV形式,我用来创建一个登录表单 - >用户验证了对数据库的凭证 - >之后状态和角色存储在会话变量中。
然后在每个页面加载我用来验证用户登录状态和授权角色&身份验证。
MVC-4有哪些可能的选择。
有人可以建议我在MVC-4中应该做些什么来实现这个,我是Mvc的新手
我尝试了什么:
我需要一些如何开始实施此指南的指南。
i want to develop an asp.net MVC4 application , and want to implement customized login mechanism,
Earlier i was using asp.net web forms, now migrating to MVC , in web form I use to create a login Form ->user is validated for credentials against database -> there after status and role is stored in Session Variable.
Then on each page load i use to verify users login status and Role for authorization & authentication.
What are possible alternatives in MVC-4.
can somebody suggest me what i should do in MVC-4 to get this implemented, i am new to Mvc
What I have tried:
I need some guidelines on how to start implementing this.
推荐答案
使用ASP.net成员资格或身份 - 两者都是为你做这些事情的框架,没有必要重新发明轮子。
Use "ASP.net membership" or "Identity" - both are frameworks that do this stuff for you, no point in re-inventing the wheel.
这篇关于如何在mvc中实现登录机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!