簡體   English   中英

ASP.NET 4.7表單身份驗證失敗,提供的票證無效

[英]ASP.NET 4.7 Forms Authentication Failure, Ticket supplied was invalid

我們正在嘗試將TLS 1.0 / 1.1更改為1.2。 運行的唯一協議是1.2,並且.net和sql已更改為支持1.2。 嘗試登錄時,它立即開始為我們提供此錯誤。

事件代碼:4005事件消息:該請求的表單身份驗證失敗。 原因:提供的票證無效。 事件時間:6/1/2018 9:27:58 AM事件時間(UTC):6/1/2018 1:27:58 PM事件ID:ed7b05ef18c84be1b02ae683df1b6e79事件序列:2事件發生:1事件詳細代碼:50201

這是在我的web.config中

    <authentication mode="Forms">
      <forms loginUrl="~/Login/MainLoginPage.aspx" defaultUrl="/default.aspx" name="LoginAuthCookie" timeout="525600" />
    </authentication>
  <location path="Mobile/Customers/CustomerList.aspx">
    <system.web>
      <httpRuntime requestValidationMode="2.0" />
    </system.web>
  </location>
  <location path="Mobile/Customers/JDE/NoCust.aspx">
    <system.web>
      <httpRuntime requestValidationMode="2.0" />
    </system.web>
  </location>
  <location path="login/mainloginpage.aspx">
    <system.web>
      <!--<pages validateRequest="false" />-->
      <httpRuntime requestValidationMode="2.0" />
    </system.web>
  </location>
  <location path="Applications">
    <system.web>
      <httpRuntime requestValidationMode="2.0" />
    </system.web>
  </location>

我們的測試頁面仍然有效,但是我們的產品頁面卻沒有,它們具有相同的web.config頁面。

我的問題是,是否有人知道為什么會發生這種情況以及如何解決? 我已經閱讀了該網站上的一些主題,但並沒有任何幫助。 讓我知道您是否需要更多信息,並在此先感謝您的答復。

您可以添加ServicePointManager.SecurityProtocol = (SecurityProtocolType) 3072; 到Global.asax.cs。

public class Global : System.Web.HttpApplication
{
    protected void Application_Start(object sender, EventArgs e)
    {
        ServicePointManager.SecurityProtocol = (SecurityProtocolType) 3072;
    }
}

我必須支持TLS1.2,這是我的付款處理器所要求的,我相信現在都可以。 我當時使用的是12歲的應用程序,所以我不想在整個應用程序中引入問題,因此我在相關頁面中插入了一行代碼,一切都很好。 那一行是:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

這將強制httprequest使用TLS1.2連接。 為我工作。

注意:我已將整個應用程序(不是問題)升級到.NET 4.5,早期版本不支持TLS1.2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM