gpt4 book ai didi

c# - 网络表单中没有 MVC 的 Oauth2

转载 作者:太空宇宙 更新时间:2023-11-03 12:44:42 25 4
gpt4 key购买 nike

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

app.UseCookieAuthentication

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

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

我已经被这个错误困扰了很长一段时间,所以在帮助或指导教程的帮助下解决这个问题将是一个很大的解脱

最佳答案

参见 here有关如何执行此操作的教程。你想要这部分:

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")
});
}
}
}

关于c# - 网络表单中没有 MVC 的 Oauth2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37746656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com