在MVC 4中使用ASP.Net Identity
发布时间:2020-05-28 07:59:41 所属栏目:asp.Net 来源:互联网
导读:在即将到来的ASP.net: http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx版本中,我一直在阅读有关新的auth的内容 我在Visual Studio 2012中创建了一个新的ASP.net M
|
在即将到来的ASP.net: http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx版本中,我一直在阅读有关新的auth的内容 我在Visual Studio 2012中创建了一个新的ASP.net MVC 4项目,我想使用新的auth位,如果可以的话.这可能吗? 我正在阅读代码,并试图围绕这个新的API.但与此同时,要走什么步骤呢? 解决方法应该是可以的,首先你基本上要安装3个包:Microsoft.AspNet.Identity.Core Microsoft.AspNet.Identity.EntityFramework Microsoft.AspNet.Identity.Owin 然后,您还需要拉入相关的Owin包: Owin Microsoft.Owin Microsoft.Owin.Security Microsoft.Owin.Security.Cookies Microsoft.Owin.Host.SystemWeb 然后你需要连接这样的东西: using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(WebApplication19.Startup))]
namespace WebApplication19
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
}
}
您还必须删除/关闭您的应用程序中的所有旧会员/表单认证,并切换到使用新的身份API. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 从ASP.NET MVC应用程序写入EventLog时的安全
- .net – HttpContext.Request和Request之间的区别
- asp.net-mvc-3 – DI模式是否限制了昂贵的对象创建以及不经
- 实体框架 – 为什么没有[Authorize(Roles =“Admin”)]在具
- asp.net – 如何使用ReportService2010命名空间呈现报告
- 发布ASP.NET vNext / DNX与CLR类库结合使用
- asp.net-mvc – IE10将令牌注入到.NET MVC链接中
- 线程安全知多少
- asp.net – 反伪造cookie令牌和表单字段令牌在MVC 4中不匹配
- 在ASP.NET上启动维护流程的最佳实践是什么
推荐文章
站长推荐
- asp.net-mvc – ViewBag和ViewData也是asp.net m
- 不确定人数的抽奖方法
- iis-7.5 – IIS 7.5 Siteminder不保护ASP.net MV
- ASP.NET MVC是否使Web表单成为旧版平台?
- ASP.NET Web Api HttpResponseException 400(错误
- asp.net-mvc – 使用Asp.net MVC 4中的OutputCac
- asp.net-mvc – ASP.NET MVC – HttpException或
- asp.net – 前端头还是后端?
- 更改ASP.NET缓存项到期的频率?
- asp.net-mvc – 如何在ASP.NET MVC中使用queryst
热点阅读
