我正在尝试在我正在开发的新页面中实现Azure Active Directory B2C,但是我得到了这个404 – 尝试从我的页面登录时找不到文件或目录错误.
我做了房客,注册了我的应用程序,创建了我的政策,整个交易.我可以从Azure门户测试它们没有太多问题.但是,我按照official tutorial上的指示来实现我的页面中的策略无济于事,我得到了提到的404错误,好像有什么东西丢失了.
我甚至下载了那里发布的代码,它的确有效!
我尝试比较两个代码,但实际上看不出有什么区别.但是,我在这里粘贴我的代码,希望你能帮我解决这个问题.
WEB.CONFIG
<add key="ida:Tenant" value="PlataformaXXX.onmicrosoft.com" /> <add key="ida:ClientId" value="84d2a6e6-4cac-4c53-a5ff-XXXXXXXXXXXX" /> <add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}/v2.0/.well-known/openid-configuration?p={1}" /> <add key="ida:RedirectUri" value="https://localhost:59744/" /> <add key="ida:SignUpPolicyId" value="B2C_1_Sign_Up" /> <add key="ida:SignInPolicyId" value="B2C_1_Sign_In" /> <add key="ida:UserProfilePolicyId" value="B2C_1_Edit" />
STARTUP.AUTH.CS
public partial class Startup { // App config settings private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; private static string aadInstance = ConfigurationManager.AppSettings["ida:AadInstance"]; private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"]; private static string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"]; // B2C policy identifiers public static string SignUpPolicyId = ConfigurationManager.AppSettings["ida:SignUpPolicyId"]; public static string SignInPolicyId = ConfigurationManager.AppSettings["ida:SignInPolicyId"]; public static string ProfilePolicyId = ConfigurationManager.AppSettings["ida:UserProfilePolicyId"]; public void ConfigureAuth(IAppBuilder app) { app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); // Configure OpenID Connect middleware for each policy app.USEOpenIdConnectAuthentication(CreateOptionsFromPolicy(SignUpPolicyId)); app.USEOpenIdConnectAuthentication(CreateOptionsFromPolicy(ProfilePolicyId)); app.USEOpenIdConnectAuthentication(CreateOptionsFromPolicy(SignInPolicyId)); } ...
如果需要任何其他代码,请告诉我.
真的很棒,任何帮助都会非常感激.
此致,Toño.