【发布时间】:2018-10-10 19:48:33
【问题描述】:
我有一个使用 Azure Active Directory 作为 SSO 的 .net 项目。经过测试,本地一切正常。
我将项目部署在具有 2 个负载均衡器的环境中,但我开始收到错误消息:
此页面无法正常工作 xxx.com 重定向您的次数过多。 尝试清除您的 cookie。 ERR_TOO_MANY_REDIRECTS
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
//This is the line causing the issue
GlobalFilters.Filters.Add(new RequireHttpsAttribute());
}
在 chrome 中网站加载正常,但在 IE 中,为 OpenId 创建的 cookie 太多。
我也试过这个:
protected void Application_BeginRequest()
{
if (!Context.Request.IsSecureConnection)
Response.Redirect(Context.Request.Url.ToString().Replace("http:",
"https:"));
}
我什至尝试过 KentorOwin:
app.SetDefaultSignInAsAuthenticationType
(CookieAuthenticationDefaults.AuthenticationType);
app.UseKentorOwinCookieSaver();
app.UseCookieAuthentication(new CookieAuthenticationOptions());
但似乎没有任何效果。
有什么帮助吗? 谢谢。
【问题讨论】:
标签: owin