简体   繁体   中英

How to prevent .net 4 handling 404 on IIS6

I have what seems to be the exact opposite of everyone else's problem! I am hosting a .Net4 site on IIS6, and while I want IIS to handle 404 errors (where I can configure it to send the error to an aspx page), it seems like .Net4 gets in the way by issuing a 302 redirect for the default page (which doesn't exist either) before I can get on with handling the 404 properly.

Basically, if I goto http://mysite/testProduct , .net4 issues a 302 for http://mysite/testProduct/default.aspx , which then goes on and gets handled by my error handling setup in IIS6 which is to redirect 404s to /404.aspx , which detects the product name, looks up an ID and does a Server.Transfer.

How can I stop .Net getting in the way? It's doubling the overhead of a page request, and will cause my products to get indexed with /default.aspx after them which I do not want.

AHA, Ben

EDIT: if I turn off CustomErrors in the web.config, .Net is still handling the error and not letting it pass to IIS at all - I see a 404 error page that is generated by .Net . So I get a 302 then a 404 ...!

最终发现了问题-这是针对nopCommerce的实现的,该实现随即提供了UrlReWriter的安装-正是该组件导致了上述行为...

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