Oauth2 在 Web 表单中没有 MVC



我有一个Web表单应用程序,我需要集成Facebook,google和Twitter登录,但是我发现所有教程都是我的解决方案没有Startup.auth.cs,然后当我实现一个Owin类并尝试调用

app.UseCookieAuthentication

我收到错误,owin.iappbuilder不包含定义。

我使用的是 4.5 .net 框架并且没有 MVC,所以任何帮助都会很棒。

我已经在这个错误上停留了很长一段时间,所以在帮助或教程的方向下解决这个问题将是一个很大的解脱

有关如何执行此操作的教程,请参阅此处。你想要这部分:

using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
[assembly: OwinStartup(typeof(WebFormsIdentity.Startup))]
namespace WebFormsIdentity
{
   public class Startup
   {
      public void Configuration(IAppBuilder app)
      {
         // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
         app.UseCookieAuthentication(new CookieAuthenticationOptions
         {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Login")
         });
      }
   }
}

最新更新