asp.net - ASP.NET 4.7 表单身份验证失败,提供的票证无效
问题描述
我们正在尝试从 TLS 1.0/1.1 更改为 1.2。唯一运行的协议是 1.2,.net 和 sql 已更改为支持 1.2。它在尝试登录时立即开始给我们这个错误。
事件代码:4005 事件消息:请求的表单身份验证失败。原因:提供的票证无效。事件时间:2018 年 6 月 1 日上午 9:27:58 事件时间 (UTC):2018 年 6 月 1 日下午 1:27:58 事件 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;
}
}
推荐阅读
- ios - 为具有多个部分的表视图创建搜索栏
- javascript - 如何通过调用 next(error) 来测试 express 中间件是否抛出错误
- c# - Asp.Net Core 3.1 MVC 客户端验证不适用于位于 Areas 文件夹中的视图
- python - python discord.py 二十一点游戏输了就会给硬币
- python - 使用烧瓶运行时找不到烧瓶模块错误
- angular - 是否可以在子窗口上订阅 observable?
- java - 隐藏我网站网址末尾的 .html
- typescript - 删除事件侦听器时没有重载匹配此调用
- kotlin - Kotlin - 如何在构建器块内迭代地图或列表
- ruby-on-rails - 如何为 Rails 5 应用程序配置模式缓存?