Re: Problem with Upload Error handling
- From: bruce barker <nospam@xxxxxxxxxx>
- Date: Tue, 28 Aug 2007 07:49:33 -0700
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
- Follow-Ups:
- Re: Problem with Upload Error handling
- From: Holysmoke
- Re: Problem with Upload Error handling
- Prev by Date: Re: CustomErrors for a 404 code
- Next by Date: Re: unable to connect to sql db
- Previous by thread: Re: Problem with Upload Error handling
- Next by thread: Re: Problem with Upload Error handling
- Index(es):
Relevant Pages
|