简体   繁体   中英

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:

<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. I see all the others though (Cache-Control, Accept, etc).

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?

Update : I'm not alone - 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). 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM