ADB2C 自定义登录页面导致错误消息 "server_error"
ADB2C Custom login page is causing the error message "server_error"
我正在尝试创建一个托管在我的 MVC Web 应用程序中的自定义登录页面,但是请求被重定向到我的默认错误页面并显示消息
"server_error".
如何找到有关此错误的更多信息?
我的自定义登录页面:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>This is my custom login page.</h1>
<div id="api"></div>
</body>
</html>
其他注意事项:
- 我的网络应用基于 Azure AD B2C: Call an ASP.NET Web API from an ASP.NET Web App。
- 我正在关注文章 Azure Active Directory B2C: Customize the Azure AD B2C user interface (UI)
- 我启用了 CORS Enabling Cross-Origin Requests (CORS)
更新:
问题是我没有在我的网络应用程序中正确启用 CORS。我正在阅读的文档是针对我正在使用的 .NET Core 与 .NET Framework 的。
我已将此添加到我的视图中。
HttpContext.Current.Response.Headers.Add("Access-Control-Allow-Origin", "https://login.microsoftonline.com");
P.S。 @spottedmahn 关于在 Chrome 控制台中保留日志的建议清楚地表明了错误发生的原因。
您可以启用应用程序洞察来记录错误。
假设您 运行 在本地,Enable SSL in IIS Express. The problem could be mixed content: HTTP & HTTPS。
此外,在您的浏览器中,启用 preserve log
;这将使您更深入地了解您的错误。
我正在尝试创建一个托管在我的 MVC Web 应用程序中的自定义登录页面,但是请求被重定向到我的默认错误页面并显示消息
"server_error".
如何找到有关此错误的更多信息?
我的自定义登录页面:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>This is my custom login page.</h1>
<div id="api"></div>
</body>
</html>
其他注意事项:
- 我的网络应用基于 Azure AD B2C: Call an ASP.NET Web API from an ASP.NET Web App。
- 我正在关注文章 Azure Active Directory B2C: Customize the Azure AD B2C user interface (UI)
- 我启用了 CORS Enabling Cross-Origin Requests (CORS)
更新:
问题是我没有在我的网络应用程序中正确启用 CORS。我正在阅读的文档是针对我正在使用的 .NET Core 与 .NET Framework 的。
我已将此添加到我的视图中。
HttpContext.Current.Response.Headers.Add("Access-Control-Allow-Origin", "https://login.microsoftonline.com");
P.S。 @spottedmahn 关于在 Chrome 控制台中保留日志的建议清楚地表明了错误发生的原因。
您可以启用应用程序洞察来记录错误。
假设您 运行 在本地,Enable SSL in IIS Express. The problem could be mixed content: HTTP & HTTPS。
此外,在您的浏览器中,启用 preserve log
;这将使您更深入地了解您的错误。