[英]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.