IIS 删除 If-None-Match 和 If-Modified-Since 标头

发布于 2024-08-22 23:44:21 字数 290 浏览 3 评论 0原文

我有一个 ASHX 处理程序或一个 ASPX 页面(这两种情况都会出现问题)。 Web 客户端发送包含 If-None-Match 和/或 If-Modified-Since 标头的请求,但 context.Request.Headers.Get("If-None-Match") 或 context.Request.Headers.Get("If- Modified-Since") 在处理程序中为 null。

相同的脚本可以在我的本地开发计算机上运行,​​但不能在在线计算机上运行(两者都在 Win 2008、.NET 3.5 上运行 IIS7)

I have an ASHX handler or an ASPX page (the problem happens in both cases).
The web client sends a request containing If-None-Match and/or If-Modified-Since headers but context.Request.Headers.Get("If-None-Match") or context.Request.Headers.Get("If-Modified-Since") is null in the handler.

The same script works in my local development machine but it doesn't work in the online machine (both are running IIS7 on Win 2008, .NET 3.5)

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

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

发布评论

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

评论(1

爱的那么颓废 2024-08-29 23:44:21

您可以在执行 apsx 页面之前使用第 3 方模块创建这些标头的副本。
例如,对于 Helicon Ape (http://www.helicontech.com/ape),这些规则可能会起作用窍门:

SetEnvIf If-None-Match (.*) e-if-none-match=$1
SetEnvIf If-Modified-Since (.*) e-if-modified-since=$1

RequestHeader set My-If-None-Match %{e-if-none-match}e
RequestHeader set My-If-Modified-Since %{e-if-modified-since}e

基本上他们获取标头并使用 My- 前缀设置新标头。仅当 IIS 不在 Ape 之前删除标头时,此操作才有效。

You may use 3rd-party module to create duplicates of those headers before apsx page is executed.
For example with Helicon Ape (http://www.helicontech.com/ape) these rules may do the trick:

SetEnvIf If-None-Match (.*) e-if-none-match=$1
SetEnvIf If-Modified-Since (.*) e-if-modified-since=$1

RequestHeader set My-If-None-Match %{e-if-none-match}e
RequestHeader set My-If-Modified-Since %{e-if-modified-since}e

Basically they get the headers and set the new ones with My- prefix. This will work only if IIS doesn’t remove headers before Ape.

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