B
Buddy Ackerman
I have a page where users upload files. I have the maxRequestLength set and
have created a Page_Error procedure to trap the error when someone load a
file that is larger than the maxRequestLength. The problem is that the page
does not render. I either get a "Document Contains No Data" message or the
browsers just sits there loading for what appears to
al eternity. Here's the Page_Error procedure:
Sub Page_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objErr As System.Exception
objErr = Server.GetLastError().GetBaseException()
Connect() 'Connects to the database
'Checks to see if the error is caused by exceeding the
maxRequestLength value
If objErr.Message.ToString() = "Maximum request length exceeded."
RenderPage("The file uploaded exceeds the maximum allowed
size.") 'outputs page data using response.write()
Server.ClearError() 'Clears the error so that it is not
processed by the Application_Error procedure
End If
di.disconnect() 'Clears the database connection
End Sub
The RenderPage procedure appears to be doing it what it's supposed to be
doing in that I can watch the database and see that it's executing the
stored procedures in that are called in this procedure.
I tried to changing the procedure to this:
Sub Page_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objErr As System.Exception
objErr = Server.GetLastError().GetBaseException()
Connect() 'Connects to the database
'Checks to see if the error is caused by exceeding the
maxRequestLength value
If objErr.Message.ToString() = "Maximum request length exceeded."
response.write("Test")
Server.ClearError() 'Clears the error so that it is not
processed by the Application_Error procedure
End If
di.disconnect() 'Clears the database connection
End Sub
But the response that I get is the "Document Contains No Data" message.
What is wrong with this procedure?
--Buddy
have created a Page_Error procedure to trap the error when someone load a
file that is larger than the maxRequestLength. The problem is that the page
does not render. I either get a "Document Contains No Data" message or the
browsers just sits there loading for what appears to
al eternity. Here's the Page_Error procedure:
Sub Page_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objErr As System.Exception
objErr = Server.GetLastError().GetBaseException()
Connect() 'Connects to the database
'Checks to see if the error is caused by exceeding the
maxRequestLength value
If objErr.Message.ToString() = "Maximum request length exceeded."
RenderPage("The file uploaded exceeds the maximum allowed
size.") 'outputs page data using response.write()
Server.ClearError() 'Clears the error so that it is not
processed by the Application_Error procedure
End If
di.disconnect() 'Clears the database connection
End Sub
The RenderPage procedure appears to be doing it what it's supposed to be
doing in that I can watch the database and see that it's executing the
stored procedures in that are called in this procedure.
I tried to changing the procedure to this:
Sub Page_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objErr As System.Exception
objErr = Server.GetLastError().GetBaseException()
Connect() 'Connects to the database
'Checks to see if the error is caused by exceeding the
maxRequestLength value
If objErr.Message.ToString() = "Maximum request length exceeded."
response.write("Test")
Server.ClearError() 'Clears the error so that it is not
processed by the Application_Error procedure
End If
di.disconnect() 'Clears the database connection
End Sub
But the response that I get is the "Document Contains No Data" message.
What is wrong with this procedure?
--Buddy