The advertisement business is one of the main revenue of the network. Through this example, readers will understand the main functions and basic principles of dynamic advertisements.
Effect description
Figure 95-1 shows the page returned after a user logs on. This page is used to enter ad image information and upload ad images to the server. Figure 95-2 shows the actual display of the ad image, which is displayed randomly based on the display probability of the ad image.
Creative conception
Use the "FileUpload" server control in ASP. NET2.0 to upload ad images to the server, and use the "update record" server action to input ad image information. Using the "Rnd ()" random function and dataset, you can achieve random display of ad images.
Procedure
Step 1. Set the application environment
(1) copy the content of instance 95 on the CD. Copy all the files in the "CD source file instance 95" directory to the "C: Inetpubwwwroot" directory. On the IIS server, set the default website's home directory to "C: Inetpubwwwrootadweb" (refer to the related methods in instance 1 ). Click "adweb" to create a new website in Dreamweaver. The website directory is "C: Inetpubwwwrootadweb". (for how to create a website, refer to instance 2 ).
(2) data structure of the "AD" table. Run Access and open "C: InetpubwwwrootadwebdataAD. mdb". You can see that the database "AD. mdb" contains "AD" and "aduser" data tables. The "AD" table is used to store AD images. The data structure of this table is shown in Figure 95-3. The "User" table is used to store the User's login name and login password. The data structure of this table is shown in Figure 95-4.
(3) create a database link "ADconn" and link the database "C: Inetpubwwwrootadweb dataAD. mdb". For details, refer to instance 75.
</