HOW TO: Use the ASP Ad Rotator Installable Component in FrontPage 2000 (312402)



The information in this article applies to:

  • Microsoft FrontPage 2000

This article was previously published under Q312402

SUMMARY

This article describes how to use the Ad Rotator installable component for Active Server Pages (ASP) in Microsoft FrontPage.

NOTE: You may receive an error message if you copy the examples directly from this article and paste them into FrontPage. The angle brackets (< and >) may appear as escaped HTML code (< and >). To work around this behavior, paste the script into a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

Creating a Rotator Schedule File

A rotator schedule file is a specialized list of advertisements to display. A double percentage sign denotes the separation of each advertisement section and a double slash indicates a comment.

For additional information, see the Rotator Schedule File Syntax section later in this article. For additional information about the formatting you can use in this file, see the References section later in this article.
  1. Start FrontPage. Open a Web on a Web server based on Microsoft Internet Information Services (IIS).
  2. On the Standard toolbar, click the New Page button.
  3. Click the HTML tab at the bottom of the FrontPage window to switch to HTML view.
  4. On the Edit menu, click Select All. Press DELETE to delete all of the existing text.
  5. Type the following text:
    REDIRECT redir.asp
    WIDTH 200
    HEIGHT 100
    BORDER 1
    *
    http://www.microsoft.com/library/homepage/images/mslogo-blue.gif
    http://www.microsoft.com/ 
    Click here for advertisement #1
    1
    http://msimg.com/w/logo.gif
    http://www.msn.com/ 
    Click here for advertisement #2
    1
    http://www.msnbc.com/i/cov/b.gif
    http://www.msnbc.com/ 
    Click here for advertisement #3
    1
    					
  6. On the File menu, click Save.
  7. In the Save as type list, click All Files (*.*).
  8. In the File name box, type AdRotator.txt and then click Save.
  9. On the File menu, click Close.

Creating a Redirection Page

Although a redirection file is not necessary, it allows you to track a customer's actions. For example, you can create a database to log how many times a specific advertisement is selected. To do this, follow these steps:
  1. On the Standard toolbar, click the New Page button.
  2. Click the HTML tab at the bottom of the FrontPage window to switch to HTML view.
  3. On the Edit menu, click Select All. Press DELETE to delete all of the existing text.
  4. Type the following text:
    <%@Language="VBScript"%>
    <%Response.Redirect(Request("URL"))%>
    					
  5. On the File menu, click Save.
  6. In the Save as type list, click All Files (*.*).
  7. In the File name box, type redir.asp and then click Save.
  8. On the File menu, click Close.

Creating the Ad Rotator Component

  1. On the Standard toolbar, click the New Page button.
  2. Click the HTML tab at the bottom of the FrontPage window to switch to HTML View.
  3. Insert the following code before the opening <body> tag:
    <%
      Dim objAdRotator
      Set objAdRotator = Server.CreateObject("MSWC.AdRotator") 
    %>
    						
    This code creates the Ad Rotator component you will use later.
  4. Click the Normal tab at the bottom of the FrontPage window to switch to Normal view.

Inserting the Ad Rotator Component on the Page

  1. Insert an HTML Markup Web component and then add the ASP code that uses the ad rotator object. To do this, perform the following steps:
      1. On the Insert menu, click Advanced.
      2. In the list of controls, click HTML.
  2. In the HTML Markup dialog box, type the following code:
    <%=objAdRotator.GetAdvertisement("AdRotator.txt")%>
    						
    This ASP code retrieves a text entry from the rotator schedule file you created earlier.
  3. Click OK to close the HTML Markup dialog box.

Saving and Previewing the Page

  1. On the File menu, click Save.
  2. In the File Name box, type AdRotatorTest.asp and then click Save.
  3. On the File menu, click Preview in Browser.
  4. Click Preview.
  5. Preview the page in your Web browser.
When you refresh the page in the Web browser, the advertisement changes.

What are Installable Components?

You can create dynamic, interactive Web pages by using the components included with Active Server Pages (ASP) in your scripts. Two built-in components are Response and Request objects. Installable components also are included with IIS.

Rotator Schedule File Syntax

NOTE: The syntax for this file is rather specialized, but easy to customize. The general format for this file is shown in the following table:
   Line   Value 1      Value 2    Description 
   ------------------------------------------------------------------------
   1      REDIRECT     [URL]      Specifies the path to the .asp file that
                                  implements redirection. 

   2      WIDTH        [Number]   Width of the advertisement on the page, 
                                  in pixels. The default is 440 pixels. 

   3      HEIGHT       [Number]   Height of the advertisement on the page,
                                  in pixels. The default is 60 pixels. 

   4      BORDER       [Number]   Width of the hyperlink border around the
                                  advertisement, in pixels. The default is
                                  a 1-pixel border. 

   5 *                            Signifies the end of the global 
                                  information section. 

   A1     [Image URL]             The URL location of advertiser A's image
                                  file. 

   A2     [Page URL]              The URL location of advertiser A's home 
                                  page.  

   A3     [Text]                  Alternate text that is displayed if the 
                                  browser does not support graphics. 

   A4     [Number]                A number between 0 and 10000 that 
                                  indicates the relative weight of 
                                  advertisement A. 

   B1     [Image URL]             The URL location of advertiser B's image 
                                  file. 

   B2     [Page URL]              The URL location of advertiser B's home 
                                  page.  

   B3     [Text]                  Alternate text that is displayed if the 
                                  browser does not support graphics. 

   B4     [Number]                A number between 0 and 10000 that 
                                  indicates the relative weight of 
                                  advertisement B. 

				
To add additional advertisements, add the four lines that define an advertisement: Image URL, Page URL, Alternate Text, and Relative Weight. For additional information, see the References section later in this article.

REFERENCES

For additional information about installable components for ASP, view the IIS documentation at the following Microsoft Web site:

Modification Type:MinorLast Reviewed:11/14/2005
Keywords:kbhowto kbHOWTOmaster KB312402