modiX modiX - 1 month ago 7
ASP.NET (C#) Question

ASPX-Handler calls full website lifecycle again

My ASPX website has CSS files and JS files linked as ASHX files. So for example I got

<script type="application/javascript" src="/JavaScript.ashx"></script>
in my markup.
When I debug the website in Chrome (newest version without add-ons) it calls the entire life cycle again.

For test purposes I cleared the ProcessRequest method of my handlers and I accessed it directly. (
After my handler finished the ProcessRequest method it jumps into the Default() constructor of Default.aspx (after that it continues to run through the whole life cycle obviously). I think after the request Chrome did access (
) in the background for unknown reason and called the life cycle of my Default.aspx seperately with
IsPostBack = false
IsCallback = false

The weird thing is in Internet Explorer 11 I do not face this problem.

How can this be?
Is this a problem of Chrome only?
Will it even appear when using a live version?
Is there any work around?


Ok I found out what it was caused by: My web.config contained

    <customErrors mode="On" redirectMode="ResponseRedirect">
        <error statusCode="404" redirect="/" />


    <httpErrors errorMode="Custom">
        <remove statusCode="404" />
        <error statusCode="404" path="/" responseMode="Redirect" />

I know that's the wrong way to handle 404 responses, but I was not on the way to leave it. I just wonder why Chrome gets a 404 response, even when my handler returns content? Because this is the only reason how it could forward to "/" and repeat my life cycle.