Brief description: After the TRY captures exception, take an exception, use server.clearrror () in the application_error of global.asax.vb, use system.web.httpContext.cRrent.Response output JavaScript code to implement information reminder and return Previous page. Detailed description: For example, the method of connecting the database is made into a class cdbconn.vb. The problem is that when the database connection fails, the system automatically throws an exception of the connection failed. Since the action after the program calls the object is not expected, it is best to end after processing the exception, the background program ends, returns the previous page. Capture in the class can also be TRY, but after processing, it is a bit troubles that the background program is ended, and it is searched in the forum. The connection is greatly given: how to: create custom er 帖 page C # .Nethttp: //support.microsoft.com/default.aspx? ScID = KB; EN-US; 306355VB.NET connection is http://support.microsoft.com/default.aspx?scid=kb;n- U.Scope: Try dbconn () Catch exception 'system.web.httpContext.current.response.write (win.msgbox (strmsg_nonedatabase) throw new system.Web.httpContext.current.response.write (win.msgbox) throw new system .EXCEPTION (STRMSG_NONEDATABASE) End try and throws an exception after intercepting exceptions. This is a bit problem, the main purpose is that it may need to deal with the trouble brought, there is nothing to handle, so it is just a custom anomalous information to the system user. Add related action Sub Application_Error (ByVal sender As Object, ByVal e As EventArgs) in Global.asax.vb Application_Error in the 'excitation Dim objErr As Exception = Server.GetLastError () when an error occurs. GetBaseException () Dim err As String = "Error Caught in Application_Error event" & _ System.Environment.NewLine & _ "Error in:" & Request.Url.ToString () & _ System.Environment.NewLine & _ "Error Message:" & objErr.Message.ToString () & _ System.environment.newline & _ "stack trace:" & objerr.stackTrace.toString ()