ASP.NET:覆盖 IIS 对“期望 100”的响应标头?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们完成此类事情的方式,我相信一种常见的方法是创建一个 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!