I have inherited some code that is not working as I think it should:
There is a form with a file upload control on it, the file limit is set to the default of asp.net 4MB.
There is no real reliable way to test for file size on the client side without using flash/active x controls.
So I am catching the error in my Global.asax file and doing a server.transfer to a new location.
The problem I am having is that the server just hangs on the transfer, the page sits there "loading" and the process remains stuck on the Server.Transfer line of code.
I have even tried just transferring on any error, but when uploading the file it just sits there.
Server.Transfer("~/Error.aspx");
Any help here would be appreciated, this is a really big stumbling block, I need to be able to handle the user uploading a file bigger than that set in the configs. without a nasty error from the framework.
Edit -- It would appear the transfer is working, as I get into the page_load events of the page I being transfered to, I can follow this through to page_prerender and then I get no rendered page and the browser just sits there looking like it is loading
Edit added stack trace of the error I am causing:
Exception = System.Web.HttpUnhandledException
Inner Exception = System.Web.HttpException
Server.GetLastError.InnerException.Message
Maximum request length exceeded.
Server.GetLastError.InnerException.StackTrace
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.GetMultipartContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Also, the file I am trying to upload is 12MB. (in case that makes a difference)
will you use response.redirect instead of server.transfer....