从A到Z的ASP【外文翻译】.doc

上传人:一*** 文档编号:77837 上传时间:2018-06-25 格式:DOC 页数:16 大小:119KB
下载 相关 举报
从A到Z的ASP【外文翻译】.doc_第1页
第1页 / 共16页
从A到Z的ASP【外文翻译】.doc_第2页
第2页 / 共16页
从A到Z的ASP【外文翻译】.doc_第3页
第3页 / 共16页
从A到Z的ASP【外文翻译】.doc_第4页
第4页 / 共16页
从A到Z的ASP【外文翻译】.doc_第5页
第5页 / 共16页
点击查看更多>>
资源描述

1、 外文翻译 原文 ASP from A to Z Material Source: Author: Nancy Winnick Cluts Introduction Theres lots of helpful information about Active Server Pages (ASP) available on this site and other sites. If you have plenty of time to search for the information, you can find answers to most of your questions. But

2、if you want to find out what tools you can use to debug ASP or how to handle errors, you need to do some digging. This article provides an easy way to find information that pertains to ASP, including a short definition of what ASP is, how ASP works, and an alphabetical list of terms and tips that re

3、late to ASP. In the A-to-Z list, you will see a brief description as well as pertinent links to more detailed information (when that information is available). This article is meant to be a “living“ document. That means that I plan on updating it with new tips and removing tips that no longer apply.

4、 If you are an ASP developer and have a “juicy“ tip, send it to me. If I publish it here, youll get credit and the everlasting gratitude of throngs of other ASP developers. What ASP Is Active Server Pages is a programming environment that provides the ability to combine HTML, scripting, and componen

5、ts to create powerful Internet applications that run on your server. If you are already creating Web sites that combine HTML, scripting, and some reusable components, you can use ASP to glue these items together. You can create an HTML interface for your application by adding script commands to your

6、 HTML pages and you can encapsulate your business logic into reusable components. These components can be called from script or other components. How ASP Works When you incorporate ASP into your Web site, heres what happens: 1. The user brings up a Web site (like MSDN Library) where the default page

7、 has the extension .asp. 2. The browser requests the ASP file from the Web server. 3. The server-side script begins to run with ASP. 4. ASP processes the requested file sequentially (top-down), executes any script commands contained in the file, and produces an HTML Web page. 5. The Web page is sent

8、 to the browser. Because your script runs on the server, the Web server does all of the processing and standard HTML pages can be generated and sent to the browser. This means that your Web pages are limited only by what your Web server supports. Another benefit of having your script reside on the s

9、erver is that the user cannot “view source“ on the original script and code. Instead, the user sees only the generated HTML as well as non-HTML content, such as XML, on the pages that are being viewed. ASP from A to Z This section contains a list of terms and tips to help you understand ASP. They ar

10、e listed in alphabetical order. Scroll down to the topic that interests you or click the letter in the alphabet below to jump down to the section containing the topic. I cribbed, er, I mean, compiled these tips and definitions from a number of sources, including technical articles (listed in the bib

11、liography below), Knowledge Base articles, and a beta version of the Microsoft Internet Information Server (IIS) 5.0 documentation (Im so lucky!). A B C D E F G I J L M O P QR S T V W X ADO Active Data Objects (ADO) provides a programming model for an OLE-DB data source. It is the database model tha

12、t ASP uses; however, ASP can use other database access mechanisms. ADO supports the following installable objects, which are often used in ASP files: Command, Connection, Recordset, Field, and Error. Refer to the ADO Web site at http:/ for more information than you can shake a stick at. Applications

13、 ASP is not just for prototyping. When using ASP as a solution, design your solution as an application instead of designing stand-alone ASP pages. As far as objects are concerned, its best to take a look at what you need to accomplish and decide what you need, then whether you can buy the objects or

14、 will need to create the objects yourself. Take into consideration caching, scalability, reusability, security, and consistency. Bottlenecks Identify your bottlenecks (that is, the database, network card, or network connection) using the tools available: WCAT, NetMon, and performance counters. To im

15、prove server performance, take a look at all parts of the system for potential bottlenecks, including hardware configuration and software settings. This way, if you are ever asked to scale the project larger, you will know where the work needs to be done. Browser Connection In IIS 4.0, use the Respo

16、nse.IsClientConnected property to determine if the browser is still connected. If the browser is not connected, you can conserve CPU cycles by ceasing the processing of the ASP page. Refer to the Knowledge Base article Use IsClientConnected to Check if Browser is Connected. Buffering Turn buffering

17、ON. By default it is OFF in IIS 4.0; in IIS 5.0, buffering is ON by default. You should buffer your ASP files so that you can abort sending a Web page. This might happen if the script being processed runs into a problem or if a user does not have appropriate security credentials. If this happens, an

18、d if you are using IIS 5.0, you can transfer the user to another page using Server.Transfer, or clear the buffer (using the Clear method of the Response object) to send different content to the user. C+ If you are creating page-level components, you can use server scriptlets, Visual Basic, Visual J+

19、, and Visual C+. If you are writing components that will be in application or session state, we recommend that you write them in C+ or Java so you can create them as both-threaded. Visual Basic is apartment-threaded. See the section below on threading for more details. Caching If your application se

20、nds pages to the client via a proxy server, the proxy server may cache pages to return them more quickly to the client. This reduces the load on the network and the Web server. To prevent a browser from caching ASP pages, set Response.Expires to some negative number. This will force the cached pages

21、 to expire immediately. If you set Response.Expires to 0, and if your browser clock is behind by a few minutes, the page wont expire immediately. If your Web site contains objects that do not expire often, such as images, set the exp iration to some time in the future. This will greatly increase the

22、 speed at which a page is refreshed or downloaded. Proxy caching via pragma:nocache is already done for you by IIS, so you dont have to set this in your headers. More information about caching can be found in Got Any Cache? Client-Side Scripts Distribute the work on your Web site by providing script

23、 on both the client and the server. See Client-Side and Server-Side Objects. COM Object Debugging If you create a COM object and use it through ASP with Server.CreateObject, you cannot go back into your development environment and recompile the COM DLL without restarting the IIS Admin and W3SVC (Web

24、 server) service. Otherwise, the COM DLL will be locked. To restart these services, do the following: 1. At a command prompt, type net stop iisadmin /y. Please note that this will shut down IIS parent service, IIS Admin. This will also shut down FTP and other services that are children of IIS Admin.

25、 If you type only net stop w3svc, inetinfo.exe will not be unloaded. 2. At a command prompt, type net start w3svc. This will restart IIS Admin and the W3SVC service (Web server). 3. You may recompile at any point after Step 1. Once you refer to an object that loads your DLL, you must repeat Step 1 b

26、efore building the component successfully. Components Use components to encapsulate the business logic in your ASP applications. You can create your own components or buy them “off the shelf.“ Once you have a component, you can reuse it wherever you need it. Develop your components using C+ or Java.

27、 Because Visual Basic is not marked as both-threaded, you cannot use Visual Basic components within application scope. If you design your own components, be sure to design components that are stateless (that is, the methods you define take parameters, rather than having a script set properties then

28、call the method without the parameters). Stateless components are far more flexible and reusable. In addition, if you have areas in your script where you have more than 100 lines of co ntiguous script, consider turning that script into a server scriptlet. More information about creating components c

29、an be found in the Active Server Components section of the Server area of the MSDN Library. A comprehensive list of third-party components available for ASP can be found in the ASP Component Catalog. Connections Pool your connections for optimal performance. By pooling your connections, your resourc

30、es are allocated more efficiently. For support of multiple logons, provide one connection for read-only access and one connection for read/write access. In general, avoid putting ADO connections in session state. ODBC (version 3.0 and later) automatically does connection pooling for you, and OLE-DB

31、provides session pooling. Cookie Munger ASP uses cookies to store the session identifier (ASP SessionID). For machines that have cookies turned off, the Cookie Munger tool can be used to strip out cookies and put the information in a URL. This enables the use of “cookies“ without actually sending ou

32、t cookies. For more information, see Simulating Cookies with the Cookie Munger. CPU Design for scalability. Stress your ASP applications at 100% CPU to determine how to best allocate your resources. Use WCAT or a third-party tool such as Mercurys LoadRunner to tune your performance. Data Access Comp

33、onents Read Improving the Performance of Data Access Components in IIS 4.0 for a detailed explanation of the techniques that you can use to improve performance. Database Use ADO for adding database access to your Web pages via components. ADO can be used to create small components that connect to an

34、y OLE-DB compliant data source, whether its relational or non-relational. This includes spreadsheets, databases, or e-mail directories. Debugging There are many tools available for debugging, including the Microsoft Script Debugger. The Script Debugger lets you run your server-side scripts one line

35、at a time, monitor the value of variables, properties, or array elements during execution, and trace procedures. Important: Once you have finished debugging your Web site, dont forget to turn off debugging on your live servers. This will increase performance. Dictionary Object The Dictionary object

36、enables you to look up and store arbitrary key-data pairs rapidly. The Dictionary object gives you access to items in the array by key, so it is faster to find things that arent stored contiguously in memory. Instead, you use a key rather than having to know where in the array the object is stored.

37、Disconnected Recordsets Disconnecting a Recordset means you can view the Recordsets data after severing the connection to the data store that generated the Recordset. You can create a disconnected ADO Recordset in-process with a Recordset whose CursorLocation property is adUseClient and whose Active

38、Connection property is set to NULL/Nothing. You can then put the Recordset into ASP application state and use the Recordset Clone method to share and access the Recordset in your ASP files. You can then pass this Recordset to a remote client using either RDS or DCOM (or both together). Read the Know

39、ledge Base articles HOWTO: Getting ADO Disconnected Recordsets in VBA/C+/Java and INFO: Disconnected Recordsets with ADO or RDS for detailed information. Error Handling You can use the ASPError object to obtain information about an IIS 5.0 error condition that has occurred in an ASP file. The ASPErr

40、or object is returned by the Server.GetLastError method. If the error condition generates an exception and you are using VBScript, use OnErr. In JScript, use the trycatch method. Detailed information about error handling can be found in the article Microsoft JScript Version 5.0 Adds Exception Handli

41、ng, by Michael Edwards. Flow Control Flow control is the ability to set the flow of your ASP application. Flow is controlled through Response methods and two new Server methods (for IIS 5.0). Using Response.Redirect causes posted data to be lost. The Response.End method causes ASP to stop when an er

42、ror is found. You do not need to call this method after calling Response.Redirect. The Server.Transfer method is the same as Response.Redirect, except that the work is done on the server and posted data is not lost. The Server.Execute method will flow into a nested ASP call and return execution to w

43、here you were before the error occurred. FileSystem Object The FileSystem object blocks on files. If you are running a high-volume Web site, dont use the FileSystem object because the performance of accessing a single file will degrade. If you are using multiple files that are not being accessed at

44、the same time, use of the FileSystem object will not result in a performance hit. Global.asa The Global.asa file is an optional file in which you can specify event procedures and declare objects that have session or application scope. It is not a content file displayed to the users; it stores event

45、information and objects used globally by the application. This file must be named Global.asa and must be stored in the root directory of the application. An application can have only one Global.asa file. Instead of using the ASP FileSystem object to read files on a page, load the file(s) into an App

46、lication level array in Global.asa. Glue Use ASP for the glue and components for the business logic. If you have 100 or more lines of consecutive script, turn it into a component using server scriptlets (bearing in mind that server scriptlets have the same limitations as Visual Basic components). In

47、etLoad The InetLoad tool can be used to tune your Web site. This tool generates customizable loads on various Internet services, over a broad range of Internet protocols, including HTTP, SMTP, POP3, and LDAP. You can use this tool to simulate traffic on your Web site. InetLoad is available at http:/

48、 See also WCATW and Mercury LoadRunner for tuning tools. Internationalization If you are providing a Web site that will be viewed in countries other than the United States, you can use the CODEPAGE tag within the delimiters to specify the proper code page. Alternatively, you can use the Session.Code

49、Page property. Read all about it at http:/ In addition to CODEPAGE, you can also use theLocal Language Identifier (LCID) to determine the language that the user has set as her preference. Detailed information about LCID can be found in theIMultiLanguage Reference. Isolation You can separate IIS, ASP, and components

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文资料库 > 外文翻译

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。