外文文献—ASP3.0和IIS5.0的新特性

上传人:aa****6 文档编号:29218479 上传时间:2018-01-22 格式:DOC 页数:13 大小:39.50KB
返回 下载 相关 举报
外文文献—ASP3.0和IIS5.0的新特性_第1页
第1页 / 共13页
外文文献—ASP3.0和IIS5.0的新特性_第2页
第2页 / 共13页
外文文献—ASP3.0和IIS5.0的新特性_第3页
第3页 / 共13页
外文文献—ASP3.0和IIS5.0的新特性_第4页
第4页 / 共13页
外文文献—ASP3.0和IIS5.0的新特性_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《外文文献—ASP3.0和IIS5.0的新特性》由会员分享,可在线阅读,更多相关《外文文献—ASP3.0和IIS5.0的新特性(13页珍藏版)》请在金锄头文库上搜索。

1、外文资料ASP 3.0 &IIS 5.0 new Characteristic propertyOne of the most exciting new features in ASP 3.0 and IIS 5.0 is the introduction of programmable serverside redirection. What this means is that, finally, we can transfer control and execution of a page to another one without having to bother the clien

2、t by using Response.Redirect. Well see what we mean by this next.The Problems with Client-side RedirectionASP programmers regularly use the Response.Redirect statement to load a different page to the one that is currently executing. However, many dont realize that this doesnt automatically cause the

3、 server to immediately load and execute the new page. What it actually does is add an HTTP redirection header to the output stream being sent from the Web server to the client. This header looks something like this:HTTP/1.1 302 Object MovedLocation newpage.aspThe standard HTTP status message in this

4、 header, 302 Object Moved, tells the browser that the resource they requested has moved. The Location header provides the address of the page they want. Of course this doesnt have to be the reality what were doing is fooling the browser into thinking that the page they want can be found at a differe

5、nt location. What is actually happening is that our server is executing the page they requested, but is telling them that the page they want has moved. This is why we have to execute the Redirect method before we send any page content to the browser.When a browser receives the 302 Object Moved messa

6、ge it responds by canceling the current request and sending a new request for the page specified in the Location value. This works in just the same way as when we use a META HTTP-EQUIV tag in the section of the page the HTTP header shown earlier is equivalent to:So the redirection is actually happen

7、ing on the client, not on our server. While this isnt generally a problem, it can cause spurious messages to be displayed if there is a proxy server in use at the client end of the connection. The proxy server will usually intercept the status message and may itself generate a page that is sent on t

8、o the client that made the original request. This is why the ubiquitous and annoying messageThe object you requested has been moved and can be found here is often displayed on the client when we use Response.Redirect, although proper use of buffering can usually prevent it.When you use Response.Redi

9、rect in IIS 4 or earlier, you should always turn on buffering at the top of your ASP page and then call Response.Clear before executing the Response.Redirect method. Of course, with page buffering being turned on by default in ASP3.0, this is not such an issue. As long as you use Response.Clear befo

10、re executing the statement, no previously generated output will be sent to the client.Server-side Redirection in ASP 3.0In ASP 3.0 and IIS 5.0, we can avoid the need to use client-side redirection in almost all cases by taking advantage of the two new Server object methods: Execute and Transfer. The

11、y cause control to be passed immediately to another page, which can be an ASP script page or any other resource such as an HTML page, zip file, or other type of file.The difference between them is that the Execute method calls the other page, much like we call a subroutine or function in our script

12、code. When the other page or resource has completed execution or streaming to the client, control passes back to the statement following the call to the Execute method in the original page, and execution continues from there. When we use the Transfer method, control does not pass back to the origina

13、l page, and execution stops at the end of the page or resource we transferred control to.What makes the two methods even more useful is that the current pages context is also passed to the target page or resource. This includes the values of all the variables in all the intrinsic ASP objects, such a

14、s the collections of the Request, Response and Session objects, and all their properties. The Application objectcontext is also transferred, even if the page is within a different virtual application.The result of all this is that the browser thinks that its still receiving the original page. It has

15、 no idea that anything unusual is going on at our server. Its Address bar still shows the same URL, and (best of all) the Back, Forward and Refresh buttons work normally. When we use client-side redirection, especially with an HTML META element, this isnt usually the case.Part of the context that is

16、 transferred to the new page or resource is any existing transaction state. While we arent going to look at transactions in detail until a later chapter, its worth mentioning here. The current pages context is encapsulated with the ASP ObjectContext object, which we discussed in Chapter 1. If we need to work with this object as part of an ongoing transaction, we can use it within the page that we transfer control to.What are Scripting Objects?An object mo

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

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号