Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Problem with Upload Error handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Holysmoke - 28 Aug 2007 09:36 GMT
Problem with Upload Error handling

When the user uploads the file greater than the length specified in
web.config/machine.config, I always see the DNS Error page eventhough I have
handled the error Page_Error Event.

And this is my code in Page_Error event,

   Private Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Error

       Dim ex As Exception = Server.GetLastError.GetBaseException

       If TypeOf (ex) Is HttpException Then

           Dim oEx As HttpException = CType(ex, HttpException)
           If oEx.ErrorCode = -2147467259 Then
               Dim ErrorLabel As New Label
               ErrorLabel.ForeColor = System.Drawing.Color.Red
               ErrorLabel.Text = "La dimensione del file supera la
dimensione massima consentita di 4MB"
               Dim oCell As New HtmlTableCell
               oCell.Controls.Add(ErrorLabel)
               trUpload.Cells.Add(oCell)
               Server.ClearError()
               Response.ClearHeaders()
               Response.Status = "200 OK"
               Response.End()
           Else
               Throw New ApplicationException(oEx.Message, oEx)
           End If
       Else
           Throw New ApplicationException(ex.Message, ex)
       End If

   End Sub

I tried to set later just to get rid of DNS Error

Response.Status = "200 OK"
Response.End()

But in vain.

Can anyone shed some light on this? Why so Response.Status does not work?

TIA,
Holy
Patrice - 28 Aug 2007 09:50 GMT
IMO the problem is that this check is done before your page even loads.  You
should be able to catch this in the Application-Error event rather than in
the Page_Error event...

---
Patrice

> Problem with Upload Error handling
>
[quoted text clipped - 45 lines]
> TIA,
> Holy
bruce barker - 28 Aug 2007 15:49 GMT
there is no cancel upload command the server can send, so when the
upload is too big, the server closes the connection. this means the
server can not send back a response, and the browser displays  failed
request error (dns in IE)

-- bruce (sqlwork.com)

> Problem with Upload Error handling
>
[quoted text clipped - 44 lines]
> TIA,
> Holy
Holysmoke - 29 Aug 2007 07:02 GMT
I solved this problem by setting maxrequestlength to 10 MB, but via code I
check for my Quota (say 5MB). I suppose this is only way to get rid of this
problem. Correct me if I am wrong. This workaround also fails if the user
tries to upload the file > 10 MB.

Thanks all,
Holy

> there is no cancel upload command the server can send, so when the
> upload is too big, the server closes the connection. this means the
[quoted text clipped - 51 lines]
> > TIA,
> > Holy

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.