Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 MVC 5 No authentication 模板创建了一个登录表单并与 MS-SQL 本地服务器连接,现在我需要使用会话验证登录状态。我尝试浏览它,但找不到最佳解决方案。所以请有人帮我确定最佳解决方案。
除非您是安全专家,否则我强烈建议您不要推出自己的身份验证。
您将在 Web 上找到的用于在 mvc 应用程序中进行身份验证的大多数文档都将引用 asp 身份。我建议使用它,除非你有充分的理由。
喜欢使用的东西
[Authorize]
关于控制器动作
并使用
User.Identity.IsAuthenticated
检查用户是否登录已全部完成。
无需重新发明轮子