Question

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. (http://localhost:1234/JavaScript.aspx). 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 (http://localhost:1234/) in the background for unknown reason and called the life cycle of my Default.aspx seperately with IsPostBack = false and 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?

Was it helpful?

Solution

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

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

and

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top