Handling 'Maximun Length Exceed' error in global.asax

Y

YaKs

Hi,

I am trying to handle th HttpException raised when you upload a file
too big. I changed the property maxRequestLength and I set it to 10000,
but I what to notice the user that the file is too big.
Finally I could handle this error at global.asax level, but when I try
to tranfer to the same page including an error flag in the session, it
takes about 10 seconds to transfer to the page and it look like my
browser shows a page from cache, it doesnt show the page processed
again because it should show the error message. If I reload the page,
then the error message appears so I am pretty sure that its a cache
problem.

I had already disabled the cache settings in my internet explorer...
:-?
maybe is it taken the page from some cache in .NET?

any idea?
any suggestion??

Thank you very much in advance
Jose

My code:

protected void Application_Error(Object sender, EventArgs e)
{
if (Server.GetLastError().InnerException.GetType().ToString() ==
"System.Web.HttpException")
{
log.Error("Aplication_Error :" +
Server.GetLastError().InnerException.Message );
Server.ClearError();
Session["Error"] = "El fichero no puede exceder los 20Mb de
tamaño.";
Server.Transfer(Request.RawUrl);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top