The Server Response File


You should now be at a point where you understand how all the different pieces of ATL Server work together to render content back to the client, so now its time to get into the code and implement the necessary logic for your number-guessing game. The best place to start is with the server response file (SRF).

The SRF is a combination of regular HTML and ATL Server replacement tags. Each tag is contained within beginning and ending double curly braces. Using Solution Explorer, open the NumberGuess.srf file contained within the NumberGuess solution.

The Visual Studio .NET IDE is registered to treat server response files as regular HTML files. SRFs, however, are dynamic in nature, so what you see when you are designing the Web page is not what you'll see when it's rendered by the client Web browser. At the bottom-left area of the main IDE window, you can see two buttons, labeled Design and HTML, on a toolbar. These buttons control how the file is displayed within the IDE when you are working with it. By default, the SRF opens in Design View and shows what the file will look like when rendered. However, as just mentioned, it doesn't have the ability to render the dynamic content, so you'll see the ATL Server tags instead of the content, which will be sent down the response stream by your tag-replacement function.

Click the HTML button to edit the file in straight text mode. What you'll see is the mixing of regular HTML tags and the double curly brace ATL Server tags. Your server response file should appear similar to Listing 14.1.

Listing 14.1 ATL Server Project Wizard Generated Server Response File
 1: <html>  2: {{// use MSDN's "ATL Server Response File Reference"  3:      to learn about SRF files.}}  4: {{handler NumberGuess.dll/Default}}  5: <head>  6: </head>  7: <body>  8: This is a test: {{Hello}}<br>  9: </body> 10: </html> 

You can use several different ATL Server tags within the SRF. The full list of available tags is provided in Table 14.1.

Table 14.1. ATL Server Replacement Tags
Tag Description
codepage The codepage tag within an SRF is used when the SRF is parsed. This is required if any characters within the file are not within the normal ANSI character set.
comment Any data within this tag is a comment and is not rendered on the client Web browser.
handler The handler tag specifies the name of the Web application DLL and the name of the request handler. There can only be one handler tag per SRF. Any additional handlers must be specified as subhandlers.
include This tag inserts the rendered content of another SRF at the current position of the SRF that uses this tag.
locale The locale tag signifies that any content rendered after that point in the file should support the locale that is specified.
replacement The replacement tag is a customized tag that is replaced with content from the request handler within your Web application DLL. It can contain either a replacement function call or rendering instructions, such as conditional statements.
subhandler The subhandler tag defines an additional request handler. Unlike the handler tag, there can be multiple subhandler tags within an SRF.


Sams Teach Yourself Visual C++. NET in 24 Hours
Sams Teach Yourself Visual C++.NET in 24 Hours
ISBN: 0672323230
EAN: 2147483647
Year: 2002
Pages: 237

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: