ASP.NET:覆盖 IIS 对“期望 100”的响应标头?

发布于 2024-08-12 01:37:46 字数 168 浏览 5 评论 0原文

我有一个 ASP.NET 应用程序,它接收来自客户端软件的请求,并且请求标头包含“请求 100-继续”。

我想覆盖 IIS 对 request-100 标头的自动响应,以便我可以使用其他标头对用户进行身份验证(或不进行身份验证),并根据状态发送正确的响应(100 继续显然已通过身份验证)或正确的错误消息。

I have an ASP.NET application that receives requests from a client software and the request headers contain a "request 100-continue".

I want to override IIS auto-response to request-100 header so that I can use the other headers to authenticate the user (or not) and send a proper response depending on the state (100 continue for authenticated obviously) or a proper error message.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

且行且努力 2024-08-19 01:37:46

我们完成此类事情的方式,我相信一种常见的方法是创建一个 HTTP 模块 - 作为请求管道的一部分,在向应用程序发出的每个请求上都会调用模块,并且可以访问整个生命周期事件的请求。您可以检查每个请求并采取操作,例如执行身份验证以及根据请求更改标头。它们还允许您检查传出的响应并对其进行修改。

来自 http://msdn.microsoft.com/en-us/library/ 的注释如果您不熟悉模块,bb398986.aspx 是一个很好的资源。

希望这有帮助!

The way we have accomplished this type of thing, and I believe a common approach is to create an HTTP Module - Modules are called on every request that is made to your app as part of the request pipeline and has access to life-cycle events throughout the request. You can examine each requests and take action such as performing your authentication, and changing the headers based on the request. They also let you examine the outgoing response and modify it.

Notes From http://msdn.microsoft.com/en-us/library/bb398986.aspx a great resource if you are new to modules.

Hope this Helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文