O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Internet Information Server

The Microsoft Internet Information Server is a web server that supports the standard Unix web-server scripting technique called the Common Gateway Interface (CGI). In addition to CGI, IIS also supports Active Server Pages (ASP), which use Active Scripting to implement a richer scripting model than offered by CGI.

Active Server Pages uses a scheme to embed the script code that is similar to Internet Explorer. Code is still delimited with <SCRIPT> tags, but the tag has a RunAt=Server attribute added. For example:

<SCRIPT RunAt=Server Language=Python>
# This code will run at the server
</SCRIPT>
<SCRIPT Language=Python>
# This code will run at the client
</SCRIPT>

Although this sounds simple, the complication again is that the object model exposed by ASP is quite different to that exposed by IE. If you attempt to call the alert() function, your code fails as alert() doesn’t exist in the ASP object model.

In addition to using <SCRIPT> tags, ASP allows alternative forms delimited by <% %> and <%= %> tags. Script code delimited by <% and %> tags are almost identical to those delimited by <SCRIPT> tags. The <%= %> tag allows you to specify arbitrary Python expressions, and the result of the expression is replaced in the output. For example, if ASP encounters HTML of the form:

Hello <%= name %>

The value of the name variable is printed in the output sent to the client.

The source files for Active Server Pages are stored as .asp files, although for all intents ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required