有两种方法可以解决这个问题。问题是 FedAuth cookie 被标记为安全和 HTTPOnly。因此,当您从 HTTPS 切换到 HTTP 时,SharePoint /_trust/ 无法读取 cookie
我采用的方法是修改 _login 目录中的 default.aspx。它可以在这里找到 C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\identitymodel\login\
我用这个 default.aspx 页面替换了现有的 default.aspx
<%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharepointIdentity" Namespace="Microsoft.SharePoint.IdentityModel" Assembly="Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" MasterPageFile="~/_layouts/simple.master" %>
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script language="C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string killed = "no";
if (Request.Cookies["FedAuth"] != null)
{
killed = "yes";
HttpCookie expiredCookie = new HttpCookie("FedAuth");
expiredCookie.Expires = DateTime.UtcNow.AddDays(-1);
Response.Cookies.Add(expiredCookie);
}
string returnURL = Request["ReturnUrl"].ToString();
Response.Redirect("/_trust/default.aspx?trust=SSO%20Trusted%20Provider&ReturnUrl=" + returnURL + "&cooke=" + killed);
}
</script>
</asp:Content>
它背后没有代码。
另一种方法是使用新的 cookie 处理程序修改 cookie。你可以在这里看到。http://www.msngn.com/blog/Lists/Posts/Post.aspx?ID=5