4

カスタムログインコードを使用したFBASharePointサイトがあります(以下を参照)。ユーザーがサイドシステムからログインし、Cookie値をに渡したときFormsAuthentication.RedirectFromLoginPage(userName, false);。ここまでは問題なく動作します。

問題は、ユーザーがシステムの外部に出て、別のユーザーIDでサインアウトしてログインし、SharePointサイトにアクセスした場合、ログインプロセスがスキップされ、ユーザーは古いID(新しいログインIDではない)でログインします。

ユーザーがsharepointサイトのURLを入力し、shareointサイトにリダイレクトされた場合、ログインプロセスを実行する方法はありますか?

教祖が私を助けてください。

    try
    {
        if (Request.Cookies[authCookie].Value.Length > 0 || Request.Cookies[authCookie].Value != null || Request.Cookies[authCookie].Value != "")
        {
            userName = Request.Cookies[authCookie].Value;
        }
    }
    catch (Exception ex)
    {
        Response.Redirect("https://qa.company.com/appssecured/login/servlet/LoginServlet?TARGET_URL=" + Request.Url);
    }
    if (true)
    {
        userName = Request.Cookies[authCookie].Value;
        FormsAuthentication.RedirectFromLoginPage(userName, false);
    }

Web.Config

<authentication mode="Forms">
  <forms loginUrl="LoginAuth.aspx" timeout="2880" enableCrossAppRedirects="false" />
  <!--      <forms loginUrl="/_layouts/login.aspx" />-->
</authentication>
4

1 に答える 1

1

使ってみませんか

FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();

これにより、Cookieが適切にクリアされ、ログインページにリダイレクトされます。

于 2012-03-19T14:43:54.660 に答える