【正文】
dialog with a script language parser. It has a Language property through which you select a language. VBscript and Jscript?are the two usual options, but provided you have a pliant parser, any scripting language is fine. Francesco Balena covered the scriptControl in detail in the July 1999 issue of MIND (see Exploring the Microsoft script Control). Tobias Martinsson39。s a programmable entity161。s main form is ready to parse and display the ASP code, it calls the ParseTextToFile method, which takes two file names: the source ASP file and the target HTML file. When the method returns successfully, the form simply navigates to the newly created local HTML page. The full source code of the CAspParser class is shown in Figure 4. Let39。s have a closer look at the implementation of the simulated ASP Response object. To further illustrate the language neutrality of COM and to avoid the problem of writing objects in Visual Basic with the same method names as some language keywords (such as Write or End), I decided to write the MyASP objects using ATL and Visual C++? The implementation of the object is straightforward (see Figure 5). The MyASP objects need to expose methods with signatures that match the way you39。s Response. You are better off writing a pletely custom object with the programming interface you prefer. The need to mimic the signatures of ASP intrinsic objects arises when you39。t have a method or property (such as ResponseBuffer) that returns the text accumulated in the internal buffer. In this clientside emulation, the browser needs to get the transformed text from the object, and a property is more helpful than a subroutine like Flush. Finally, the End method sets an internal variable to false. This variable is exposed through the CanContinue property and is used to stop the loop that governs the parsing of the ASP text. As you can see, the programming interface of the object is similar161。the ASP Response object. The logic behind the two objects is shared to some extent, but it clearly differs as the working context of the client and serverside editions of Response requires. In Figure 6 you can see that both the custom browser and Inter Explorer render my simple page in the same way. If you open Explorer in the folder that contains the specified ASP page and doubleclick the item, in most cases Visual InterDev?will open because it is the program that is usually registered to edit ASP files. If you want to be able to doubleclick on ASP files and see their content, you could associate them with a program like Visual InterDev. However, remember that a generic ASP page might be using objects like Session or Application that the clientside parser doesn39。ll see that the HTML the browser receives from the Web server is exactly the same. Figure 7 Using ?? A possible stumbling block in the conversion process is the meaning of the = sign which is often used within %...% code blocks to denote . In fact, The value of X is %= x% is exactly the same as The value of X is % x % To deal with this particular situation (and other similar circumstances) I39。ll cover those topics next month. Figure 9 The Page Rendered in Inter Explorer?? In Figure 9 you can see how Inter Explorer renders this page. Figure 10 shows that the offline parser renders it the same way. Figure 10 The Page Rendered in the ASP Browser?? Let39。re clicking from pages/ then the browser attempts to navigate to In an offline scenario, though, you39。s schema for navigation. While the schema has been drawn with Inter Explorer in mind, it is general enough to be extended to all browsers. There are at least three ways a user can ask the browser to move to a URL: from the address bar, through page links, or via scripting. In all cases, the request is queued to an internal module that prepares the actual HTTP request for the Web server or manages to do otherwise for local files. When you ask the browser to navigate to a local ASP page, there39。t know how to move back and forth between local ASP pages. To create a custom history mechanism you can use a special system folder for persistence and a collection to keep information in memory. Conclusion You can use the Microsoft scriptControl to execute any VBscript or Jscript code block, and to populate the scripting context with custom objects. This way, you can emulate all the ASP intrinsic objects and add new ones as well. A browser that can handle clientside ASP pages must behave in slightly different ways than regular Web browsers. This is particularly true of hyperlinks, navigation, and forms. 功能強(qiáng)大的 ASPHTML 轉(zhuǎn)換工具 將 ASP 腳本轉(zhuǎn)換為 HTML ASP 是特別依賴(lài)微軟公司的能力的一項(xiàng) Web 技術(shù)嗎? 因特網(wǎng)信息 服務(wù)(IIS)。 不過(guò),當(dāng)你從探險(xiǎn)者那里雙擊一個(gè) ASP 文件時(shí),你不能要瀏覽器翻譯它 進(jìn) HTML。 赫斯提及了腳本。 例如,一供應(yīng)者的目錄或許你將不斷改進(jìn)只幾次 A的種數(shù)據(jù) 年。 直到 IIS ,有一次 .asp 擴(kuò)展的全部資源受影響是 分析,無(wú)論是否他們包含書(shū)寫(xiě)代碼。 此外,我的客戶保證由這用戶機(jī)器開(kāi)出的任何特別軟件配置不能,和 只有可能被CD 提供的產(chǎn)品是微軟公司 IE 或者一個(gè)風(fēng)俗 Web 瀏覽器。 在這個(gè)欄目里,我將討論脫機(jī)的 ASP 觀眾和一些實(shí)施細(xì)節(jié)的建筑。 我將不采訪象會(huì)議或者應(yīng)用那樣的其他 ASP 物體,因?yàn)樗麄兒苌俦辉诒镜啬_本里需要。 否則,它叫一個(gè)風(fēng)俗模件當(dāng)?shù)胤治?ASP 文件的內(nèi)容。 當(dāng)我將使用 Visual Basic 時(shí)? 這里,你能 此外使用 C++。 圖 2 為瀏覽器顯示代碼。 初始化保證那些寫(xiě)稿環(huán)境 正確地初始化和準(zhǔn)備工作。 它找到 %161。%對(duì) 輸出緩沖器,和啟動(dòng)適合關(guān)閉的標(biāo)簽, 百分之 的新搜尋 。 這些著名的物體被在圖 3 列舉 。 州 是把變量和物體與一個(gè)特別的用戶聯(lián)系起來(lái)的能力。 實(shí)際上,一次一個(gè)用戶通常訪問(wèn)并且說(shuō)明管理是一本地 ASP 頁(yè) 一個(gè)不那么重要的問(wèn)題。 沒(méi)有服務(wù)器通常簡(jiǎn)單得多的這次干涉的那些 Web 消耗并且沒(méi)全部需要 有特色一在線 Web 應(yīng)用。 只請(qǐng)求 暴露 QueryString 收集。 在執(zhí)行書(shū)寫(xiě)代碼,兩者 中 任 何 一 個(gè) 趁 著 微 軟 公 司 你 書(shū) 寫(xiě) 控 制 一 可 下 載 零 部 件( ),或者使用未加工 Windows 書(shū)寫(xiě) COM 接口。 它有你選擇 A的語(yǔ)言特性 語(yǔ)言。 當(dāng)涉及使用 scriptControl 時(shí),你需要做 3 件事情: 建立語(yǔ)言,作為很多增加 盡管你給書(shū)寫(xiě) namespace 想要,并且執(zhí)行書(shū)寫(xiě)代碼目的。 整套命名試題結(jié)構(gòu)書(shū)寫(xiě)的 namespace。 你能給這添加新名字 namespace。 每個(gè)電話兌這幾次元素被自動(dòng)安排對(duì) 你作為 AddObject 的第 2 場(chǎng)辯論確切說(shuō)明的 COM 物體。 偶然,這是允許 IIS 注入真實(shí)的 ASP 目標(biāo)模型在里的相同的技術(shù) 一 ASP 頁(yè)服務(wù)器邊的寫(xiě)稿的上下文。 全部源碼 CAspParser 種類(lèi)被用圖 4 顯示。 因?yàn)槊髁酥?(參閱圖 4),我使用 。 那把正文積累進(jìn)一個(gè)內(nèi)部的線緩沖區(qū) 努力趕上真正的 ASP 反應(yīng) 物體寫(xiě)的這條溪。 這種清楚的方法扮演完全相同的角色它在真正的 ASP 里做 你在服務(wù)器上習(xí)慣于的