简体   繁体   English

ASP.NET HTTP保持活动连接上下文

[英]ASP.NET HTTP Keep-Alive Connection Context

I am working on replacing integrate windows authentication in an ASP.NET application by handling the NTLM authentication manually. 我正在通过手动处理NTLM身份验证来替换ASP.NET应用程序中的集成Windows身份验证。 The NTLM authentication is not a problem, I have a complete open source implementation of the NTLM SSPI module ( https://github.com/FreeRDP/FreeRDP/tree/master/winpr/libwinpr/sspi/NTLM ). NTLM身份验证不是问题,我具有NTLM SSPI模块的完整开源实现( https://github.com/FreeRDP/FreeRDP/tree/master/winpr/libwinpr/sspi/NTLM )。 My main problem is with the fact that NTLM is connection-oriented, while HTTP is normally stateless. 我的主要问题是NTLM是面向连接的,而HTTP通常是无状态的。 After reading about NTLM authentication, it is described as requiring the use of the HTTP Keep-Alive, where no cookie is being sent with every request. 在阅读了有关NTLM身份验证的内容后,它被描述为要求使用HTTP Keep-Alive,其中每个请求都不会发送cookie。 As long as the connection is kept alive, the NTLM authenticated state remains. 只要连接保持活动状态,NTLM身份验证状态就会保留。

I found ways to properly enable HTTP keep-alive in IIS, but I found no way in ASP.NET to associate data with a specific connection. 我找到了在IIS中正确启用HTTP保持活动状态的方法,但是在ASP.NET中却找不到将数据与特定连接相关联的方法。 Even if a cookie can be given to the client at the end of NTLM, NTLM cannot be completed if no session state is maintained between receiving the NTLM CHALLENGE and sending the NTLM AUTHENTICATE message. 即使可以在NTLM末尾向客户端提供cookie,如果在接收NTLM CHALLENGE和发送NTLM AUTHENTICATE消息之间没有会话状态保持不变,则NTLM无法完成。 Obviously, when using the built-in integrated windows authentication support of IIS, it is able to keep track of the state between the multiple steps of NTLM authentication. 显然,当使用IIS的内置集成Windows身份验证支持时,它可以跟踪NTLM身份验证多个步骤之间的状态。

What I am looking for is a way to track multiple requests coming in for the same HTTP connection that is kept alive. 我正在寻找的是一种跟踪保持活动的同一HTTP连接的多个请求的方法。 Data in HttpRequest appears to only be specific to the current request, and nothing allows me to identify the connection. HttpRequest中的数据似乎仅特定于当前请求,没有任何内容可以让我识别连接。 At best, maybe one of the server variables ( http://msdn.microsoft.com/en-us/library/ms524602.aspx ), like the connection ephemeral port, could be used to identify the same connection. 充其量,也许可以使用服务器临时变量之一( http://msdn.microsoft.com/zh-cn/library/ms524602.aspx )(例如临时连接端口)来标识相同的连接。 This could potentially work, but I could not find a way to reliably detect when the associated connection is closed. 这可能会起作用,但我找不到可靠的方法来检测关联的连接何时关闭。

Ideas, anyone? 想法,有人吗?

There is no such a way to find out whether the current request is in new tcp connection or re-used the connection. 没有这种方法可以确定当前请求是在新的tcp连接中还是在重新使用该连接。

It can be done by sent extra header to identified current tcp connection in http header. 可以通过向HTTP标头中标识的当前tcp连接发送额外的标头来完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET Core与ESP32保持连接 - ASP.NET Core keep-alive to ESP32 如何在ASP.NET Web服务客户端请求上禁用keep-alive? - How can I disable keep-alive on ASP.NET Web Service client requests? 发送连接标头设置为keep-alive - Sending connection header set as keep-alive 通知的保持活动连接C# - Keep-Alive connection for notifications C# 了解正确的http keep-alive实现 - understanding correct http keep-alive implementation 服务器关闭保持活动状态的HTTP连接时检测或避免客户端CommunicationException - detecting or avoiding client CommunicationException when server closes keep-alive http connection 建立httpheader连接:保留小写的“保持活动”状态 - Make httpheader Connection: Keep-Alive into lower-case “keep-alive” 在C#(.NET 4.6)中关闭保持活动状态的FTP或FTPS连接的最佳方法? - Best method to close a keep-alive FTP or FTPS connection in C# (.NET 4.6)? 在C#(.net)下具有HTTP服务器的Keep-Alive套接字如何发送几个查询? - Keep-Alive socket with HTTP server under C# (.net) how to send several queries? ASP.NET Core 3.0 MVC 连接中的 SignalR 无法正常工作? - SignalR in ASP.NET Core 3.0 MVC connection keep alive not working?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM