473,469 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

File Upload too large error.

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
Nov 19 '05 #1
6 3593
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

Nov 19 '05 #2
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 <cl********@nospamath3osoftware.com>
| 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: <89**********************************@microsoft.co m>
| In-Reply-To: <89**********************************@microsoft.co m>
| Content-Type: text/plain; charset=UTF-8; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <#m*************@TK2MSFTNGP15.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 65.166.186.188
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.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
|

Nov 19 '05 #3
Steve,

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

Thanks,
Alan

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:P6*************@TK2MSFTNGXA01.phx.gbl...
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 <cl********@nospamath3osoftware.com>
| 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: <89**********************************@microsoft.co m>
| In-Reply-To: <89**********************************@microsoft.co m>
| Content-Type: text/plain; charset=UTF-8; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <#m*************@TK2MSFTNGP15.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 65.166.186.188
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.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
|

Nov 19 '05 #4
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/is...d/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: <89**********************************@microsoft.co m>
<#m*************@TK2MSFTNGP15.phx.gbl>
<P6*************@TK2MSFTNGXA01.phx.gbl>
| 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: <#$**************@TK2MSFTNGP15.phx.gbl>
| 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!TK2MSFT NGP15.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
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:P6*************@TK2MSFTNGXA01.phx.gbl...
| > 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 <cl********@nospamath3osoftware.com>
| > | 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: <89**********************************@microsoft.co m>
| > | In-Reply-To: <89**********************************@microsoft.co m>
| > | Content-Type: text/plain; charset=UTF-8; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <#m*************@TK2MSFTNGP15.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 65.166.186.188
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.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
| > |
| >
|
|
|

Nov 19 '05 #5
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...ing-large.html

Pass the message people!

Hope this helps...
Etienne

Nov 19 '05 #6
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.....

"la******@yahoo.fr" wrote:
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...ing-large.html

Pass the message people!

Hope this helps...
Etienne

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
4
by: Joe | last post by:
Hello, I have IIS 6.0 running on w2k3 Enterprise. I have three upload forms 1 to have restricted uploads .asp 2 to upload plain .asp any extension 3 a FP form upload non .asp
6
by: Thomas Due | last post by:
Hi, I am writing an ASP.NET project where I allow users to upload files to the server. I have changed to web.config to allow a total file size of 100MB. My problem is that if the total file size...
14
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the...
8
by: Braky Wacky | last post by:
Hello, I have an ASP.NET webpage that uses an instance of System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our server. I came across the documentation at MSDN for upping the...
6
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page...
4
by: jf li | last post by:
I have a Asp.net web application and a Asp.net Web service application. The Web application is using HtmlInputFile to get a 50M size of file selected by end user, read the data of this file and...
4
by: Jim Michaels | last post by:
after a file upload, $_FILES is not populated but $_POST is. what's going on here? $_POST=C $_POST=C $_POST=C $_POST=C:\\www\\jimm\\images\\bg1.jpg $_FILES= $_FILES= $_FILES=
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.