reg uploading huge files.

  • Thread starter Thread starter muthu
  • Start date Start date
M

muthu

hi friends,
I am developing ASP.NET application which allows user to upload the
files upto 10 MB.
But if the user selects the file to upload more than 10 MB the
application crashes with error.
I have tried the follwoing to prevent the crash.

if (System.IO.Path.GetFileName(Request.Path).ToLower() ==
"default.aspx")
{
System.Exception appException = Server.GetLastError();
HttpException chkException = (HttpException) appException;
if ((chkException.GetHttpCode() == 500 ||
chkException.GetHttpCode() == 400) && chkException.ErrorCode ==
-2147467259)
{
Session.Add("ImageTooLarge",true);
Server.ClearError();
Response.Redirect("Default.aspx");
}

}

But it didnt help me.
Also I have used Custom errors

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="400" redirect="UploadError.htm" />
<error statusCode="500" redirect="UploadError.htm" />
</customErrors>

This also not helped me from that error.

Friends please help me what to do..
Thanks and regards,
Muthu Kumaran.D
 
Back
Top