版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、外文资ASP3.0&IIS5.0newCharacteristicOne of the most exciting new features in ASP 3.0 and IIS 5.0 is roduction programmable serverside redirection.What this means t, finally, we can transfer control executionofa page tovingtobother外文资ASP3.0&IIS5.0newCharacteristicOne of the most exciting new features in
2、 ASP 3.0 and IIS 5.0 is roduction programmable serverside redirection.What this means t, finally, we can transfer control executionofa page tovingtobotherthentbyusing WellseewhatwemeanbythisTheProblemswithnt-sideASPprogrammers regularly use the Response.Redirect ement to load a different page the t
3、is currently executing. However, many dont t this doesnt cause the server to y load and execute the ge. What it actually does is add HTTPredirectionheadertotheoutputstreambeingsentfromtheWebservertotheThisheaderlookssomethinglikeHTTP/1.1302ObjectLocationThe standard HTTP us his header, 302 Object ls
4、 the tresource they requested has moved. The Location rovides the address of the they want. coursethis ve tobe thereality what ng isfooling the o t page they want can be found at a different location. What is happening t our server executing the page they requested, but ling t page they s moved. Thi
5、s is why we have to execute the Redirect method before we anypagecontenttotheWhenabrowserreceivesthe302ObjectMovedmessageitrespondsbycancelingtherequest and sending a new request for the page he Location value. This works in the same way as when we use a METAHTTP-EQUIV he section of the page theHTTP
6、headershownrisequivalent So the redirection is actually happening on the nt, not on our server. While this generally a problem, it can cause spurious messages to be displayed if there is a proxy server use at the nt end of the connection. The proxy server will ercept the us and may itself generate a
7、 t is sent on to the t made the original request. This whytheubiquitousandannoyingThe object you requested has been moved and can be found here is often displayed on ntwhenand may itself generate a t is sent on to the t made the original request. This whytheubiquitousandannoyingThe object you reques
8、ted has been moved and can be found here is often displayed on ntwhenweuseResponse.Redirect,althoughproperuseofbufferingcanusuallypreventWhen you use Response.Redirect S 4 or r, you should always turn on buffering the top of your ASP page and then call Response.Clear before executing the method. Of
9、course, with page buffering being turned on by default in ASP3.0, this is not such ie. As long as you use Response.Clear before executing the ement,no previously outputwillbesenttotheServer-sideRedirectioninASPInASP3.0andIIS 5.0,we canavoidtheneedtouse nt-sideredirectioninalmostallby taking advantag
10、e of the two new Server object methods: Execute and Transfer. They control to be passed y to age, which can be an ASP script page or any resourcesuchasanHTMLpage,zipfile,orothertypeofThe difference n them t the Execute method calls the age, much like call a subroutine or function in our script code.
11、 When the age or resource has execution or streaming to the nt, control passes back to the ement following the call to Execute he original page, and execution continues from there. When we use Transfermethod, controldoesnotpass backto theoriginal page,andexecution stopsthepageorresourcewetransferred
12、controlWhat makes the two methods even more useful t the current pages context passed to page or resource. This includes the values of all the variables in all rinsicASPobjects,suchasthecollectionsoftheRequest,Responseandobjects,andtheirproperties.TheApplicationcontextisalsotransferred,evenifthepage
13、iswithinadifferentvirtualThe result of all this t the browser t its still receivingthe original page. sno tanything unusual is going on at our server. Its Addressbar still shows the same and (best of all) the Back, Forward and Refresh buttons work normally. When we use nt-redirection,llynHTMLMETAele
14、ment,thisisntusuallythePart of the t is transferred to the ge or resource is any existing e. While we arent going to look at ions in detail until a later chapter, its mentioning here. The current pages context is encapsulated with the ASP ObjectContext which we discussed in Chapter 1. If we need to
15、work with this e. While we arent going to look at ions in detail until a later chapter, its mentioning here. The current pages context is encapsulated with the ASP ObjectContext which we discussed in Chapter 1. If we need to work with this object as part of an ion,wecanuseithe twe transfercontrolWha
16、tareScriptingAn object is basically a way of understanding how the various parts of the systemThe ASP object provides a t we can use to manipulate the he HTTPrequests and responses, and the ASPenvironment as a whole. For we saw how we can find out the values of s sent from the browser by scollection
17、,whichispartof theASPRequestThe scripting languages we use also have an object . However, this is for t the scripting languages provide, as ed to the objects like Request and t are provided directly by the ASP DLL. The scripting objects are provided by Scripting Runtime Library (scrrun.dll), which i
18、s installed with the default Active Scripting providesthreemainobjectsaspartoftheScriptingRuntimeThe Dictionary object provides a useful storage t we can use to store sedandreferencedbytheirnamenbyindex,aswouldbe thecaseina normalFor le, its ideal for storing the name/value t we retrieve from the AS
19、P The FileSystemObject object provides us cs to the underlying file system on server (or on the nt in IE5 when used in conjunction with a l type of page named Hypertext Application or HTA). We can use the FileSystemObject object to iterate through machineslocalandnetworkeddrives,foldersandTheTextStr
20、eamobjectprovidesstofilesstoredondisk,andisusedinconjunctionthe FileSystemObject object. It can read from or write to text (sequential) files. It can only instantiated via the FileSystemObject object, so you might prefer to think of it as a child The ASP Server object is designed to provide the feat
21、ures we need to create these components and applications, t we can use them to extend the capabilities of our scripts. It does this by implementing a l ofthe CreateObject method. Well see thisisrequiredCreatingObjectinVBScriptandInVisualBasic orVisualthese components and applications, t we can use t
22、hem to extend the capabilities of our scripts. It does this by implementing a l ofthe CreateObject method. Well see thisisrequiredCreatingObjectinVBScriptandInVisualBasic orVisualBasicforApplications(VBA),wecancreate of objects avarietyofways.WecanusetheNewkeywordtocreateanewobjectofthetypeDimHoweve
23、r,thissibleinASPwithVBScriptor JScript,because these scriptingdont implement y. We cant declare a variable as being of any specific ype areallVariantsoranequivalenttype(dependingonthescriptinglanguageinternative in Visual Basic and VBAis the use of eric methods. The CreateObject method takes as its
24、argument a or (more usually) a string,andreturnsa newobjecttSetobjNewObject=TheGetObject methodis normallyusedwhenwe haveofa specifictype,andwanttocreate aninstance ofantcanhandlethistype :SetobjExcel=Weso specify the type of t we want as well as a filename, which is useful wehaveseveraltcan tSetobj
25、Excel=GetObject(C:myfilessales.xlw,VBScript supports CreateObject and GetObject. s getObject, which works like VBScript. JScript also implements a t he same way as the CreateObjectmethod, namedActiveXObject.However this isused inconjunction withthe new objNewObject=newWith the exception of the Visual Basic New keyword, which isnt supported in VBScript JScript, we can use all these techniques to create of objects within an ASP However, can doesnt
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广东省佛山市2023-2024学年六年级上学期英语期中试卷(含答案)2
- 编制说明《绿色产品评价 打印机及多功能一体机》国家标准-征求意见稿
- 金属非金属矿山地表安全设施技术规范DB41-T 2081-2020
- 江西省人民防空工程建设技术要求(2021版)
- 乘除法的关系和乘法运算律乘除法的关系课件
- 山东省威海市2020届高三地理下学期第二次模拟试题含解析
- 2024年Α-乙酰乳酸脱羧酶合作协议书
- 德育教育社会实践活动方案
- 2024年煤制天然气项目合作计划书
- 2024年电力金具项目合作计划书
- 蛙人下水道施工方案
- 电价执行错误整改方案范本
- 带状疱疹护理查房
- 综掘机、综掘工艺专项安全风险辨识评估报告
- 小学数学-倒数的认识教学设计学情分析教材分析课后反思
- 食品金属探测器安全操作及保养规程
- 大学生实用法律知识讲座
- T-QGCML 1301-2023 智慧空压站设计规范
- 2010年辽宁省中考语文现代文之说明文阅读5篇
- 农村土地承包调解仲裁与仲裁庭审技巧课件
- 基于GeoGebra的数学研究与教学应用课件
评论
0/150
提交评论