Recommended: Examples explain how to use the disconnect record set in ASP When we use ASP's built-in ADO components for database programming, we usually open a connection at the beginning of the script and close it at the end of the script, but for larger scripts, the connection is open much longer in most cases than it needs to be opened. Therefore
In VBScript, there is an OnErrorResumeNext statement that causes the script interpreter to ignore runtime errors and continue execution of the script code. Then the script can check the value of the Err.Number property to determine whether an error occurred. If an error occurs, a non-zero value is returned. In ASP3.0, you can also use OnErrorGoto0 to go back to the default error handling. This kind of processing is actually performed in ASP2.0, but there is no corresponding document description. This is common in many asp data-related processing files. Add OnErrorResumeNext to turn off the default error processing and then use err to catch it.
| IfErrThen err.Clear There is an error in Response.Write! Response.End EndIf |
In order to get a more detailed error description, let's try the asperror object. It is a new object of asp3.0. It can be obtained through the getlasterror method of the server object. Asperror provides detailed information about the last error in asp. Unlike the Err object in VBScript, this method cannot be called at any time to see if an error occurs. It can only be used in an ASP customized error web page. If used by turning off the default error handling (using the OnErrorResumeNext statement) like using the Err object, the GetLastError method cannot access the detailed data of the error.
Properties of ASPError object:
The ASPError object provides nine attributes to indicate the nature and source of the error that occurred, and returns the actual code that caused the error. The properties and descriptions are as follows:
ASPCode: Integer. Error number generated by ASP/IIS, such as 0x800A009
ASPDescription: String type. If this error is an ASP-related error, this property is a detailed description of the error. For example: AllHTTP:HTTP_ACCEPT:*/*HTTP_ACCEPT_LANGUAGE:zh-cnHTTP_CONNECTION:Keep-AliveHTTP_HOST:sHTTP_USER_AGENT:Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.0;(R11.5)).. There are also reports such as cookies.
Category: String type. The source of the error is that of the ASP internal scripting language, or an object.
Share: Please pay attention! Common ASP script attacks and prevention techniques Due to the convenience and ease of use of ASP, more and more website background programs use the ASP scripting language. However, because ASP itself has some security vulnerabilities, it will provide hackers with an opportunity to take advantage of it if they are not careful. In fact, security is not only a matter of network management, but programmers must also be in certain security.
7 pages in total Previous page 1234567Next page