473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Page_Error doesn't render output

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
Jul 21 '05 #1
0 1196

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

Similar topics

1
by: bondzhou | last post by:
I have the following code in Page_Error handler subroutine: Exception ex =Server.GetLastError(); Response.Write(ex.Message); Response.Write(ex.StackTrace); Server.ClearError(); But it...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
4
by: Alex Nitulescu | last post by:
Hi. I read about Page_Error and Application_Error. However, I provoke an error in a page but still Page_Error won't run. This is all the code I have left in my page: ...
1
by: Buddy Ackerman | last post by:
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....
2
by: Carl Johansen | last post by:
I've been reading the O'Reilly "ASP.NET Cookbook" 1st edition (Kittel and LeBlond), and it makes a recommendation about exception handling that seems a bit strange. They say that, if you want to...
6
by: Matt | last post by:
Can anyone give me a good reason to use BOTH application scope Page_Error and the page scope Page_Error when trapping errors in a web application? Is there any real benefit to using the Page_Error...
2
by: Matt | last post by:
As the subject says... are Application_Error and Page_Error triggered by the same event? In other words, is there any error that could slip by Application_Error but be caught by Page_Error, or...
3
by: Carlo Razzeto | last post by:
Is there anyway to inline Page_Error type global error handling in an ASP.Net webpage? Currently I work on a very large web system where the entier web front end is contained in a single project...
0
by: David Gardner | last post by:
In ASP.net 1.1 I created a based class that was inherited by all of the pages in my project. That way I had a centralized location to handle/log any uplanned errors that occured on any page. I...
2
by: Erik Lautier | last post by:
I've got Page_Error emailing me the message and stack trace when a server error is generated, but it doesn't always work. My Page_Error code: Sub Page_Error(ByVal src As Object, ByVal args As...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.