|
en Explorer in the folder that contains the specified ASP page and double-click 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 double-click 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 client-side parser doesn't support.
Figure 6 The Custom Browser versus Internet Explorer
Consider a page like the following, which is nearly identical to the previous one except for a Response.End statement. <html> <body> <% x=1 %> <% Response.Write "Hello, world!" %> <hr> <% Response.End %> The value of X is <%= x%> </body> </html>
Figure 7 shows that the End method correctly stops the processing. If you're confused by the truncated output in the HTML textbox, don't be too concerned. Try viewing the same document through Internet Explorer and HTTP and you'll see that the HTML the browser receives from the Web server is exactly the same.
Figure 7 Using Response.End
A possible stumbling block in the conversion process is the meaning of the = sign which is often used within <%...%> code blocks to denote Response.Write. In fact, The value of X is <%= x%>
is exactly the same as The value of X is <% Response.Write x %>
To deal with this particular situation (and other similar circumstances) I've added the ResolveAmbiguity method to the CAspParser class. Each time that the script command begins with "=" it replaces the character with a Response.Write.
A More Complicated Page So far I've worked with a very simple ASP page. Let's use the client-side parser to work with a more complex ASP page that involves databases. Figure 8 shows an ASP page that fills and displays a table with a few records taken from an OLE DB data source. Despite the use of ActiveX Data Objects (ADO), the structure of the page is relatively simple. To make this example more realistic I would need to implement the Request object and the simulation of the POST and the GET HTTP commands. I'll cover those topics next month.
Figure 9 The Page Rendered in Internet Explorer
In Fi上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |
|
|
|
|
|
|
|