简体   繁体   English

IIS7的自定义重定向不会传递If-Modified-Since标头。 错误?

[英]IIS7's custom redirection doesn't pass If-Modified-Since header. Bug?

We're using the following technique to catch all non-existing URLs and provide our own resulting page: 我们使用以下技术来捕获所有不存在的URL并提供我们自己的结果页面:

<handlers>
  <add name="Foo" path="foo.aspx" verb="*" type="Foo.UrlHandler" preCondition="integratedMode,runtimeVersionv2.0"/>
</handlers>

<httpErrors errorMode="Custom">
  <remove statusCode="404"/>
  <remove statusCode="405"/>
  <error statusCode="404" path="/foo.aspx" responseMode="ExecuteURL"/>
  <error statusCode="405" path="/foo.aspx" responseMode="ExecuteURL"/>
</httpErrors>

However, when I check which request headers are being passed to the UrlHandler , I see all but one: the If-Modified-Since header doesn't get passed. 但是,当我检查哪个请求标头被传递给UrlHandler ,我只看到一个:If-Modified-Since标头没有被传递。 I see all the others though (Cache-Control, Accept, etc). 我看到了所有其他的(Cache-Control,Accept等)。

Had any experience with this? 有这方面的经验吗? It's kind of related to this question: 这与这个问题有关:

Posting forms to a 404 + HttpHandler in IIS7: why has all POST data gone missing? 将表单发布到IIS7中的404 + HttpHandler:为什么所有POST数据都丢失了?

Update : I'm not alone - http://www.webmasterworld.com/microsoft_asp_net/3935439.htm 更新 :我并不孤单 - http://www.webmasterworld.com/microsoft_asp_net/3935439.htm

Solved. 解决了。 In case anyone has the same problem: 万一有人有同样的问题:

I changed the project to a .NET MVC (2, but 1-3 should all do fine). 我将项目更改为.NET MVC(2,但1-3应该都可以。) Made a single route to catch-all: 制定一条通往全部的路线:

public static void RegisterRoutes(RouteCollection routes)
{
  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  routes.MapRoute("All", "{*url}", new { controller = "CatchAll", action = "Index" });
}

Then added a single CatchAll controller to do exactly as my HttpHandler once did. 然后添加了一个CatchAll控制器,就像我的HttpHandler一样。

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

相关问题 System.Net.Http.HttpClient添加If-Modified-Since标头 - System.Net.Http.HttpClient adding If-Modified-Since header 我不能在WebClient上设置If-Modified-Since吗? - Can't I set If-Modified-Since on a WebClient? 在我的HttpHandler中缓存XML输出对我不起作用“ If-Modified-Since”始终为空 - Caching of XML output in my HttpHandler don;t work for me “If-Modified-Since” is always null 一个在IIS7中不起作用的HttpModule - A HttpModule that doesn't work in IIS7 ASP.NET 核心 Web API 检查 if-modified-since Z099FB995346F31C749F6E4000 因为浏览器没有提交到服务器 - ASP.NET Core Web API checking if-modified-since header not working because browser does not even submit to server Asp.Net Web Api 2中的If-Modified-Since - If-Modified-Since in Asp.Net Web Api 2 尽管有WWWfilter,但已部署IIS7的MVC仍未重定向 - IIS7 deployed MVC doesn't redirect despite WWWfilter .NET IIS7无法删除X-AspNetMvc-Version标头? - .NET IIS7 can't remove X-AspNetMvc-Version header? 由于WebClient的uploadData不对数据进行编码,因此向其添加“Content-Type”,“multipart / form-data”标头会产生什么影响? - Since WebClient's uploadData doesn't encode data, then what will be the effect of adding a “Content-Type”, “multipart/form-data” header to it 在 IIS7 上显示自定义错误的问题 - Problem with getting custom errors to display on IIS7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM