Re: Problem with Upload Error handling

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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)

Holysmoke wrote:
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
.



Relevant Pages

  • Re: Problem with Upload Error handling
    ... upload is too big, ... Dim ex As Exception = Server.GetLastError.GetBaseException ... If TypeOf Is HttpException Then ... I tried to set later just to get rid of DNS Error ...
    (microsoft.public.dotnet.framework.aspnet)
  • Altering file name in ASPUpload
    ... I am using ASPUpload to upload a txt or doc file to my server. ... DIM File, Upload, Count, Ext ... Response.Write "There was an error sending your message. ...
    (microsoft.public.scripting.vbscript)
  • Re: Unable to upload images larger than 131 071 bytes
    ... >> Shawn: ... Cannot Upload Large Files When You Use the HtmlInputFile Server ... I'm letting the users upload images into a sybase 12.5 database. ... >>> Dim oleDbCommand As OleDbCommand ...
    (microsoft.public.dotnet.framework.aspnet)
  • Uploading Files Using Javascript: Cant Access File Collection On Server
    ... i am using an iFrame to pass a url string of files to upload to server. ... Dim iFile As Integer ...
    (microsoft.public.dotnet.general)
  • Re: Best way to upload?
    ... Does you Web host support file upload software from a third-party? ... The full physical path to each file (on the server) is stored in "FileName". ... Dim strFOL ... '* Process Files ...
    (microsoft.public.inetserver.asp.db)