简体   繁体   English

在VS2015中创建MVC网站后添加身份

[英]Add Identity after creating an MVC website in VS2015

when I create an MVC website in VS2015 I can select Individual Identity, so the project will come with all the Account stuff.(like Login, logout, [Authorize] ...) 当我在VS2015中创建MVC网站时,我可以选择“个人身份”,因此该项目将包含所有“帐户”内容(例如“登录”,“注销”,“ [授权] ...”)

the question is: if I just created a new Project with choosing: no Authentication. 问题是:如果我刚刚选择以下选项创建了新项目:无身份验证。 and I wanted to add the Account stuff. 我想添加“帐户”内容

is there a way to do it automatically without the need to write everything from scratch? 有没有一种方法可以自动执行而无需从头开始编写所有内容? (specially the Authorize Attribute and register it in Principal) (特别是授权属性并在主体中注册)

And if not, what ist the easiest way to do a simple login? 如果没有,那么简单登录的最简单方法是什么?

thank you. 谢谢。

It can be done, If you're looking for Microsoft Identity it's available as a nuget package: https://www.nuget.org/packages/Microsoft.AspNet.Identity.Owin/ 如果您正在寻找Microsoft身份,则可以将其作为nuget包使用: https ://www.nuget.org/packages/Microsoft.AspNet.Identity.Owin/

But be aware that installing it this way will not auto generates all the stuff the project template does you'll have to do some manual implementation. 但是请注意,以这种方式安装它并不会自动生成项目模板所需的全部内容,而您需要手动执行一些操作。 I recommend making a new site with Authentication and look at it to see what's missing and need to be added manually. 我建议使用身份验证创建一个新站点,然后查看它以了解缺少的内容,需要手动添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM