【问题标题】:Visual Studio 2013 Change Authentication on Existing ProjectVisual Studio 2013 更改现有项目的身份验证
【发布时间】:2013-11-05 07:35:03
【问题描述】:

如果我在 Visual Studio 2013 中有一个现有项目,如何更改身份验证?在新项目设置期间,有一个“更改身份验证”按钮,但我找不到现有项目的等效项。

【问题讨论】:

标签: asp.net .net authentication visual-studio-2013


【解决方案1】:

直到有人提出更好的答案:

手动编辑您的 web.config 和 FederationMetadata.xml。

【讨论】:

    【解决方案2】:

    如果你的项目是 ASP.NET MVC 并且在 2013 年使用新模板,它应该在 OWIN 上运行,所以里面有一个部分类 Startup,如果你有它,有一个文件 Startup.Auth.cs 是 Startup 的一部分,我有这个

    public partial class Startup
    {
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(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("/Authentication/Login")
            });
    
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
    
            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");
    
            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");
    
            //app.UseFacebookAuthentication(
            //   appId: "",
            //   appSecret: "");
    
            //app.UseGoogleAuthentication();
    
        }
    } 
    

    那里,是你的认证配置

    【讨论】:

    • 这假设已经通过包管理器控制台安装了“Open Web Interface for .NET”(Owin):Install-Package Owin
    【解决方案3】:

    这可以从项目属性中完成。我正在发布指向article which explains how to do this.的链接

    【讨论】:

    • 查看属性窗口中的部分标题,它是开发服务器。问题是关于项目的身份验证,而不是服务器的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-17
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    相关资源
    最近更新 更多