![](/img/trans.png)
[英]ASP.NET Forms Authentication failed for the request. Reason: The ticket supplied has expired
[英]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.