外文翻译---什么是ASP文件

上传人:红** 文档编号:171431454 上传时间:2022-11-26 格式:DOC 页数:7 大小:60.93KB
返回 下载 相关 举报
外文翻译---什么是ASP文件_第1页
第1页 / 共7页
外文翻译---什么是ASP文件_第2页
第2页 / 共7页
外文翻译---什么是ASP文件_第3页
第3页 / 共7页
点击查看更多>>
资源描述
What is an ASP File?With ASP files, you can activate your Web site using any combination of HTML, scripting-such as JavaScript or Visual Basic Scripting Edition (VBScript)-and components written in any language. This means your ASP file is simply a file that can contain any combination of HTML, scripting, and calls to components. When you make a change on the ASP file on the server, you need only save the changes to the filethe next time the Web page is loaded, the script will automatically be compiled. How does this happen? It works because ASP technology is built directly into Microsoft Web servers, and is thus supported on all Microsoft Web servers: Windows NT Internet Information Server (IIS) 3.0, Windows NT Workstation, and Windows 95 Personal Web Server.The object model of ASP, Microsoft styleHeres how it works. When a browser requests an ASP file from your Web server, your Web server calls Active Server Pages to read through the ASP file, executing any of the commands contained within and sending the resulting HTML page to the browser. An ASP file can contain any combination of HTML, script, or commands. The script can assign values to variables, request information from the server, or combine any set of commands into procedures. ASP uses the delimiters (better known to you and me as thing-a-ma-bobs that specify the beginning and end) to enclose script commands. For example, the code below sets the value of the variable MyFavTVShow in the user cookies to I Dream of Jeannie. The scripting languages supported by ASP in turn support use of the If-Then-Else construct (something that will undoubtedly warm the hearts of all coders out there). Finally, you can embed some real logic into your HTML. For example, the following code from the IIS documentation shows how you can set the greeting shown based upon the time of day.= #12:00:00 AM# And Time Good Morning!Hello! Im sure that you can think of something more interesting for your Web siteId hate to have to come up with all of the clever ideas.Built-in ObjectsASP includes five standard objects for global use: Requestto get information from the user Responseto send information to the user Serverto control the Internet Information Server Sessionto store information about and change settings for the users current Web-server session Applicationto share application-level information and control settings for the lifetime of the application The Request and Response objects contain collections (bits of information that are accessed in the same way). Objects use methods to do some type of procedure (if you know any object-oriented programming language, you know already what a method is) and properties to store any of the objects attributes (such as color, font, or size).The Request objectThe Request object is used to get information from the user that is passed along in an HTTP request. As I mentioned earlier, the Request and Response objects support collections: ClientCertificateto get the certification fields from the request issued by the Web browser. The fields that you can request are specified in the X.509 standard QueryStringto get text such as a name, such as my favorite TV sitcom above Formto get data from an HTML form Cookiesto get the value of application-defined cookie ServerVariablesto get HTTP information such as the server name The Response objectThe Response object is used to send information to the user. The Response object supports only Cookies as a collection (to set cookie values). The Response object also supports a number of properties and methods. Properties currently supported are: Bufferset to buffer page output at the server. When this is set to true, the server will not send a response until all of the server scripts on the current page have been processed, or until the Flush or End method has been called. ContentTypeto set the type of content (i.e: text/HTML, Excel, etc.) Expiressets the expiration (when the data in the users cache for this Web page is considered invalid) based on minutes (i.e.: expires in 10 minutes). ExpiresAbsoluteallows you to set the expiration date to an absolute date and time. Statusreturns the status line (defined in the HTTP specification for the server). The following methods are supported by the Response object: AddHeaderAdds an HTML header with a specified value AppendToLogAppends a string to the end of the Web server log file BinaryWritewrites binary data (i.e, Excel spreadsheet data) Clearclears any buffered HTML output. Endstops processing of the script. Flush-sends all of the information in the buffer. Redirectto redirect the user to a different URL Writeto write into the HTML stream. This can be done by using the construct Response.write(hello) or the shortcut command The Server objectThe Server object supports one property, ScriptTimeout, which allows you to set the value for when the script processing will time out, and the following methods: CreateObjectto create an instance of a server component. This component can be any component that you have installed on your server (such as an ActiveX ). HTMLEncodeto encode the specified string in HTML. MapPathto map the current virtual path to a physical directory structure. You can then pass that path to a component that creates the specified directory or file on the server. URLEncodeapplies URL encoding to a specified string. The Session objectThe Session object is used to store information about the current users Web-server session. Variables stored with this object exist as long as the users session is active, even if more than one application is used. This object supports one method, Abandon, which (believe it or not!) abandons the current Web-server session, destroying any objects, and supports two properties, SessionID, containing the identifier for the current session, and Timeout, specifying a time-out value for the session. One thing to bear in mind about the session identifier: Its not a GUID. Its only good as long as the current Web-server session is running. If you shut down the Web-server service, the identifiers will start all over again. So dont use it to create logon IDs, or youll have a bunch of duplicates and one heck of a headache.The Application objectThe Application object can store information that persists for the entire lifetime of an application (a group of pages with a common root). Generally, this is the whole time that the IIS server is running. This makes it a great place to store information that has to exist for more than one user (such as a page counter). The downside of this is that since this object isnt created anew for each user, errors that may not show up when the code is called once may show up when it is called 10,000 times in a row. In addition, because the Application object is shared by all the users, threading can be a nightmare to implement.什么是ASP文件利用ASP文件,你可以用HTML和脚本的任何组合来激活网页,比如用JAVASCRIPT或者VBSCRIPT和用任何语言表示的元件。这说明你的ASP文件只是包含了适合其元件的任何HTML和脚本的结合。当你在服务器上对ASP文件做出改变的时候,你只需要将这种改变保存到文件中当下次网页载入时,脚本会自动被编译。怎么会这样呢?因为ASP技术是直接植入微软网页服务器中的,而且所有微软网页服务器都支持该技术:Windows NT IIS3.0,Windows NT Workstation,以及Windows 95个人网页服务器。以下是它如何工作的。当浏览器从你的网页服务器中请求一个ASP文件时,你的网页服务器就让ASP去通读一遍这个ASP文件,执行任何包含其中的命令,和发送最终的HTML页到浏览器。一个ASP文件可以包含任何HTML和脚本或者命令的组合。脚本可以分配数值给变量,向服务器需求信息,或者合并一套命令到程序中。ASP用将封闭的脚本命令定界。比如,以下的源码是将cookies中的变量MyFavTVShow的值赋予I Dream of Jeannie. ASP所支持的脚本语言也相应地支持ITE构造(这将无可置疑的鼓舞编码者)。最后,你能将一些真正的逻辑嵌入你的HTML。比如说,以下源码是从IIS文档中显示你如何在一天中的特定时间表示问候。= #12:00:00 AM# And Time Good Morning!Hello! 我确定你能让你的网站更加丰富多彩在此,我就不再一一列举了。构建对象ASP包括五个全球通用的标准对象: 请求从用户获取信息 响应发送信息给用户 服务器控制IIS 对话储存相关信息以及改变用户现有的网页服务器的对话构造 应用分享应用层次信息以及终生控制应用程序请求与响应对象包含类集(字节信息以相同的方式被存取)。对象用一些方法来运行一些类型的程序(只要你懂得任何一种面向对象的编程语言,你就会知道该用哪种方法)以及存储在任何一个对象属性里面的特性(比如颜色,字体或是大小)。请求对象请求对象往往用来从通过HTTP请求的用户获取信息。正如之前所说,请求和响应对象支持类集: 客户认证从网页浏览器发布的请求中获取认证域.你能请求的域是由X.509标准指定的。 查询字符串获取文本,比如名字,比如象上面的我最喜欢的电视节目。 表格从HTML表格中获取数据 Cookies从应用定义cookie中获取数值 服务器变量获取HTTP信息比如服务器名称 响应对象响应对象是用来给用户发送信息的。响应对象支持象类集这样的cookies(给cookies定值)。响应对象也支持很多属性和程序。现时支持的属性包括: 缓冲区缓冲区服务器建立连接输出的页面. 当这个连接是正确的时, 服务器将不会发送响应直到所有的服务器脚本在当前的页面上被公开, 或者直到刷新或是结束程序被请求。 内容类型创建内容类型(比如:text/HTML, Excel等) 期限创建截止时间 (当用户的高速缓存中的网页数据被认为无效时)以分计数 (比如: 10分钟到期). 绝对期限同意你创建绝对的日期和时间的截止时间数据 状态返回状态行 (HTTP规约中微软对服务器的定义). 响应对象支持以下程序: 添加标题用特定数值添加一个HTML标题 拼接记录在网页服务器的记录文件最后添加一个字符串 二进制编写编写二进制数据 (比如,电子表格数据) 清除清除任意的HTML缓冲的输出. 结束停止脚本程序. 刷新发送缓冲区中所有的信息. 重定向给用户重定向一个不同的URL 编写写进HTML流中。 这可以用作图来处理 Response.write(hello) or the shortcut command 服务器对象服务器对象支持一个属性,脚本超时当脚本进程将超时的时候,它允许你设定一个值,用以下方法: 创建对象创建一个服务器元件事例。 这种元件可以是你的服务器上创建出的任何元件 (比如ActiveX )。 HTML编码在HTML中编写一个特定的字符串。 标出路线在一个物理目录结构中标出现时的虚路线。然后你可以将此路径遍历到创建这个特定目录的元件上或者保存文件到服务器上。 URL编码将URL编码应用到特定的字符串。对话对象对话对象是用来储存与现有用户的网页服务器对话相关信息的。这个对象储存的变量只能在用户对话处于活动状态时存在,即使超过一个申请在被使用时。这个对象支持一种方法,Abandon放弃现有网页服务器的对话,破坏所有的对象,支持两种属性:1,SessionID包括现有对话的标识符;2,Timeout为对话设定一个超时的值。关于对话的标识符,应该记住一点:这不是一个GUID。它只在现有的网页服务器对话运行时生效。如果你关闭网页服务器服务,标识符会重新启动。所以不要用它创建登陆的用户名,否则你会有一大堆的让你头疼的复写。应用对象应用对象可以持续终身地储存信息(一组同根的页面)。一般而言,这是指IIS服务器运行的整个时间。这使得它成为一个为多个用户而存在的好地方(比如页面计数器)。这种方式有下降的趋势,因为这个对象不能为每一个用户再创建,这种错误在源码被调用一次时可能不会显现,但是当它在一行中被调用10,000次时便会显现。而且,因为应用对象是被所有用户所分享的,线程便成为了执行的阻碍。
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸设计 > 外文翻译


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!