【发布时间】:2013-08-31 17:20:45
【问题描述】:
我已将 SQL-Server Reporting Services 2012 (SSRS 2012) 切换为表单身份验证,以便我们可以通过 Internet 使用它。
我无法在任何地方找到适用于 SSRS 2012 的表单身份验证示例,因此我不得不采用 SSRS 2008R2,并将其调整为 2012 年的单点登录 (SSO)。
那时一切似乎都按预期进行;我什至设法让 SSO 跨域工作。
但是现在我有一个问题:
我正在使用 Google Chrome 测试所有报告(超过 200 个),因为我必须插入一些 JavaScript 来更改 td 边框大小,以便 HTML 在非 IE5-QuirksMode 下正确显示。大约在第 50 次报告之后,我突然得到:
“HTTP 400 错误请求 - 请求太长”
在那之后,我无法查看任何其他报告,甚至那些之前确实有效的报告。
问题似乎是由于 cookie 过多造成的,实际上,当我删除了一些“*_SKA”(Session Keep Alive?)cookie 后,它又开始工作了。
我现在的问题是我不知道是什么导致了这个“cookie 溢出”。 我也不知道这是 Chrome 中的 bug,vanilla SSRS 中的 bug 还是新表单身份验证引起的 bug。
我在新表单中所做的所有与 cookie 有关的身份验证是这样的:
using System;
using System.Collections.Generic;
using System.Text;
namespace FormsAuthentication_RS2012
{
internal class FormsAuthenticationWorkaround
{
public static void RedirectFromLoginPage(string strUser, bool createPersistentCookie)
{
//string url = System.Web.Security.FormsAuthentication.GetRedirectUrl(strUser, true);
string url = GetRedirectUrlWithoutFailingOnColon(strUser, createPersistentCookie);
SQL.Log("User: '" + strUser + "' ReturnUrl", url);
if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Response != null)
System.Web.HttpContext.Current.Response.Redirect(url);
}
// https://github.com/mono/mono/blob/master/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
// @MSFT: WTF are u guys smoking ?
public static string GetRedirectUrlWithoutFailingOnColon(string userName, bool createPersistentCookie)
{
if (userName == null)
return null;
System.Web.Security.FormsAuthentication.SetAuthCookie(userName, true, "/");
string returnUrl = null;
if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Request != null)
returnUrl = System.Web.HttpContext.Current.Request.QueryString["ReturnUrl"];
if (returnUrl != null)
return returnUrl;
returnUrl = System.Web.Security.FormsAuthentication.DefaultUrl;
return returnUrl;
}
}
}
因为这段代码创建了在底部看到的“sqlAuthCookie”。只有一个“sqlAuthCookie”,所以我认为这不可能是表单身份验证错误。
问题似乎在于 SKA cookie,AFAIK 与表单身份验证无关,而与 Vanilla SSRS 无关。
我能看到的唯一其他原因是我在 web.config 文件的 forms-authentication 部分中输入的 forms-authentication-cookie 超时更改为 720 分钟。
<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="720" path="/">
</forms>
</authentication>
有人知道我可以做些什么来防止被 Session Keep-Alive cookie 淹没(手动删除这些 cookie 除外)吗?
这对我本身来说没有问题,除了它非常烦人之外,但这将是一个问题,因为用户可能不会很理解这一点......
【问题讨论】:
标签: asp.net cookies reporting-services forms-authentication ssrs-2012