I'm using <requestLimits maxAllowedContentLength="[my limit]"/>
to limit the size of file uploads over http. This works fine, and returns a 404.13 (Content length too large) when the limit is exceeded. I'm logging it in my global.asax as follows:
private void Application_EndRequest(object sender, EventArgs e)
{
if (Response.StatusCode == 404 &&
Response.SubStatusCode == 13)
{
// file is too big
}
}
My problem is with the way that browsers are responding to this. It appears that the browser ignores the 404.13 and continues to send the entire file anyway. Is there any way to stop this waste of bandwidth?