S
sam
Hi,
I have seen many posts about this problem and no resolution.
I have set the maxRequestLength to 200K as I don't want anyone
uploading files to the server greater than this size.
I have put code into Application_BeginRequest and Application_Error to
try and trap the error of "Page Not Found". Nothing seems to stop the
inevitable of the browser going to the "Page Not Found" page. I have
even put in the web.config custom errors, trapping the 404 error and
also set a defaultRedirect. None of this has any difference.
In Application_BeginRequest I have:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
// stop the page continuing if the post is greater than 300K (this
// caters any text uploaded with the form submit
if (Context.Request.ContentLength > 300000)
{
Response.Clear();
Response.Redirect("ErrorPage.aspx", true);
}
}
It does break into here, and it does run the Response.Redirect
command, yet.. I am still re-directed to the Page Not found page. I
have breakpoints everywhere and no matter where I try to trap the
error, it still goes to the Page not found page. Even tried using
Page_Error on the page where the upload is taking place.
Has anyone got any further ideas? I have searched Google over and over
and everyone seems to have the same problem but with no solutions. :|
Thanks,
Sam
I have seen many posts about this problem and no resolution.
I have set the maxRequestLength to 200K as I don't want anyone
uploading files to the server greater than this size.
I have put code into Application_BeginRequest and Application_Error to
try and trap the error of "Page Not Found". Nothing seems to stop the
inevitable of the browser going to the "Page Not Found" page. I have
even put in the web.config custom errors, trapping the 404 error and
also set a defaultRedirect. None of this has any difference.
In Application_BeginRequest I have:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
// stop the page continuing if the post is greater than 300K (this
// caters any text uploaded with the form submit
if (Context.Request.ContentLength > 300000)
{
Response.Clear();
Response.Redirect("ErrorPage.aspx", true);
}
}
It does break into here, and it does run the Response.Redirect
command, yet.. I am still re-directed to the Page Not found page. I
have breakpoints everywhere and no matter where I try to trap the
error, it still goes to the Page not found page. Even tried using
Page_Error on the page where the upload is taking place.
Has anyone got any further ideas? I have searched Google over and over
and everyone seems to have the same problem but with no solutions. :|
Thanks,
Sam