File Upload too large error.

G

Guest

Hi there,

When adding a "File Field" HTML control to an aspx page to facilitate file
uploading, the following occurs:

1. You select a file that is larger than the allowed size limit.
2. Once the user selected the too large file, the page is redirected to a
"page not found" error page.
3. This is as per the docs, but my question is:

How do I intercept the request before it redirects to the "page not found"
error page? If a user sees that, it leads to confusion. I need to handle the
case when the user chooses too big a file, with an error message or whatever.

Any ideas?

Regards
Paul
 
S

Steven Cheng[MSFT]

Hi Paul,

As for the ASP.NET fileupload problem, it does be a known issue of the
current ASP.NET runtime. When the httpRequest's length exceed the
HttpRuntime/@maxRequestLength setting, there'll occur HttpException
internally and the clientside will get a "Page can not be displayed" error.

The problem here is that this HttpException is thrown internally and before
our Page class/ HttpHandler is initiliazed/loaded so that we can not
capture the error in our page/handler code. Also, neither can we get it in
the Application_Error, it is likely the ASP.NET runtime abort the request
as soon as it read the data from stream and detect that the size exceed the
limit.

Due to this limitation, currently if we really want to avoid such behavior,
one possible means is to use a raw IIS ISAPI filter to perform the
fileupload function. Sorry for the inconvenience it brings you.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Date: Tue, 26 Jul 2005 08:15:46 -0700
| From: Clint Hill <[email protected]>
| Organization: H30 Software
| User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: File Upload too large error.
| References: <[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=UTF-8; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 65.166.186.188
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:114499
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I have handled this in the past by using a HttpHandler to intercept the
| file and check it's size. Look up Custom Handlers to see if this would
help.
|
| Clint Hill
| H3O Software
| http://www.h3osoftware.com
|
| Paul wrote:
| > Hi there,
| >
| > When adding a "File Field" HTML control to an aspx page to facilitate
file
| > uploading, the following occurs:
| >
| > 1. You select a file that is larger than the allowed size limit.
| > 2. Once the user selected the too large file, the page is redirected to
a
| > "page not found" error page.
| > 3. This is as per the docs, but my question is:
| >
| > How do I intercept the request before it redirects to the "page not
found"
| > error page? If a user sees that, it leads to confusion. I need to
handle the
| > case when the user chooses too big a file, with an error message or
whatever.
| >
| > Any ideas?
| >
| > Regards
| > Paul
|
 
A

Alan Dennis

Steve,

Does Microsoft have a file upload ISAPI filter available for download?

Thanks,
Alan
 
S

Steven Cheng[MSFT]

Hi Alan,

Thanks for your response. I didn't known any existing ISAPI, but there're
some tech articles discussing how to create one through ISAPI extension,
here is a msdn article on this:

#ISAPI Extensions: Creating a DLL to Enable HTTP-based File Uploads with IIS
http://msdn.microsoft.com/msdnmag/issues/01/10/Upload/default.aspx

Also, you can try searching in the www.asp.net or codeproject since
there're also some 3rd party upload components there.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "Alan Dennis" <sinned_l_nala@liamtoh_backwards.com>
| References: <[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: File Upload too large error.
| Date: Fri, 29 Jul 2005 10:27:42 -0500
| Lines: 97
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: pool-68-238-153-63.dllstx.fios.verizon.net
68.238.153.63
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:115174
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steve,
|
| Does Microsoft have a file upload ISAPI filter available for download?
|
| Thanks,
| Alan
|
| | > Hi Paul,
| >
| > As for the ASP.NET fileupload problem, it does be a known issue of the
| > current ASP.NET runtime. When the httpRequest's length exceed the
| > HttpRuntime/@maxRequestLength setting, there'll occur HttpException
| > internally and the clientside will get a "Page can not be displayed"
| > error.
| >
| > The problem here is that this HttpException is thrown internally and
| > before
| > our Page class/ HttpHandler is initiliazed/loaded so that we can not
| > capture the error in our page/handler code. Also, neither can we get
it
| > in
| > the Application_Error, it is likely the ASP.NET runtime abort the
request
| > as soon as it read the data from stream and detect that the size exceed
| > the
| > limit.
| >
| > Due to this limitation, currently if we really want to avoid such
| > behavior,
| > one possible means is to use a raw IIS ISAPI filter to perform the
| > fileupload function. Sorry for the inconvenience it brings you.
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| > --------------------
| > | Date: Tue, 26 Jul 2005 08:15:46 -0700
| > | From: Clint Hill <[email protected]>
| > | Organization: H30 Software
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: File Upload too large error.
| > | References: <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=UTF-8; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 65.166.186.188
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:114499
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | I have handled this in the past by using a HttpHandler to intercept
the
| > | file and check it's size. Look up Custom Handlers to see if this would
| > help.
| > |
| > | Clint Hill
| > | H3O Software
| > | http://www.h3osoftware.com
| > |
| > | Paul wrote:
| > | > Hi there,
| > | >
| > | > When adding a "File Field" HTML control to an aspx page to
facilitate
| > file
| > | > uploading, the following occurs:
| > | >
| > | > 1. You select a file that is larger than the allowed size limit.
| > | > 2. Once the user selected the too large file, the page is
redirected
| > to
| > a
| > | > "page not found" error page.
| > | > 3. This is as per the docs, but my question is:
| > | >
| > | > How do I intercept the request before it redirects to the "page not
| > found"
| > | > error page? If a user sees that, it leads to confusion. I need to
| > handle the
| > | > case when the user chooses too big a file, with an error message or
| > whatever.
| > | >
| > | > Any ideas?
| > | >
| > | > Regards
| > | > Paul
| > |
| >
|
|
|
 
L

lambi_uk

Hi Guys,

no need to go that far people!!! No need for custom ISAPI filters or
ActiveX Components!

I have been going crazy on this for the past couple of months and some
genius guy posted an extremely good article on a VERY simple way to
overcome the maxRequestLength and the nasty DNS "page not found" error
you get if uploading something bigger.

I explain everything in this post:
http://etiennel.blogspot.com/2005/08/htmlinputfile-problem-uploading-large.html

Pass the message people!

Hope this helps...
Etienne
 
G

Guest

Etienne,

The solution listed on your blog does not work for everyone, including me.
I'm not sure why this works for some and not all???

Thanks.....
 

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,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top