我正在尝试为我的网站安装 Steam 登录,但是在我使用以下安装代码在 nuget 包管理器控制台中完成安装之后:Install-Package Owin.Security.Providers.Steam
我丢失了我的 Startup.Auth.cs
。我究竟做错了什么?
该项目在没有“个人用户帐户”的情况下启动。
最佳答案
Startup.Auth.cs
文件应该在您的 App_Start
文件夹中。只需创建一个默认的 MVC Web 应用程序,并在 Change Authentication
选项下选择 Individual User Accounts
作为身份验证类型,以查看其实现方式。
供引用:
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
using Owin.Security.Providers.Steam;
namespace WebApplication
{
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
//other Config
app.UseSteamAuthentication("your API key");
}
}
}
参见 here有关如何添加 Steam 登录按钮的引用。
编辑: 另见 here对于 Adding MVC 5 Identity to our Existing Project.
您可能需要将 startup.cs 添加到项目的根目录中:
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(WebApplication1.Startup))]
namespace WebApplication1
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
关于c# - 没有获取 Startup.Auth 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37433790/