ASP's Actual Treatment of Strong Page Structure

xiaoxiao2021-03-06  95

ASP's Actual Treatment of Strong Page Structure

Date: 2003-5-27 21:34:13 Source: ZDNET Author: - Error handling is one of the programmers grumbling something. Let us face it, the code we don't write is wrong. . . Or similar ideas. Unfortunately, there may be many reasons for runtime errors in your code, from hardware, software changes to code using other development teams, and so on. Effective processing of these errors and minimizes the interrupt of the normal operating process of the website is the responsibility of each conscience. Within the scope discussed herein, there are three different places to occur: scripts, middleware, and IT internal architectures. IT internal architecture errors, reducing periodic performance, and causes IIS to crash almost unavoidable. This type of error usually can only call technical support and will allow system administrators for a long time. Developers cannot do what to prevent such errors, but we usually cope with and correct the errors in scripts and middleware. After installation of IIS, the default server-side scripting language is set to VBScript. Many web development teams have kept these default settings in their development environment, because VBScript is very poor for handling runtime errors. In VBScript, the only error handling structure that developers can use is the on Error ResMe next and ON Error Goto 0 (turn off error handling function). In order to use this error handling structure in your ASP page, you may need to use these structures to include code that may throw an exception, just below: <% DIM MyVAR on Error Resume Next '' The following line of code will be in MSXML 4.0 No Error Set Myvar = Server.createObject ("MSXML2.DOMDocument.4.0") if Err.Number <> 0 Then '' is handled by error handling error handle processing error. Error Can't discover the ON Error Goto 0 else '' MyVar now pointing to an instance of MSXML 4.0 DomDocument '' End Error handle, avoiding errors that occur later cannot be discovered to be on Error Goto 0 end if, if you see, if You have to use the above rules on every line of existing error, your program will be full of "on err.number <> 0 dam...". On the other hand, JScript has built-in support for a robust error handling mechanism "Structured Exception Handling (SEH)". Use SEH to make your software development team to transfer to the .NET environment, because SEH is JScript.net, VB.NET, and C # default error handling mechanism. (Note: .NET does not support VBScript.

转载请注明原文地址:https://www.9cbs.com/read-124492.html

New Post(0)