Real-Life ASP (5): Add banner ads to WAP mobile Web pages with ASP

Source: Internet
Author: User
Tags sql access database microsoft access database
Advertising | Web page | Advertising uses ASP to add banner ads to WAP mobile Web pages

In my previous article, "How to use WML and ASP technology to write dynamic mobile phone pages," I introduced how to generate dynamic WML Web pages using ASP. In this article, I would like to further explain how to use ASP to develop dynamic WML Web pages and their applications. In fact, think about it, you can use server-side programming (for example, ASP) to develop a lot of applications on WAP phones, as long as they directly generate WAP mobile phone can identify WML pages. For example, in this article to introduce, how to WAP and other wireless devices to develop a circular banner advertising system.

Figure one shows a schematic of a banner advertisement, which is a possible way to display banner ads on a WAP site.
Using this method, you can add a circular banner ad to your site, can give users who use wireless internet surfing a chance, let them understand faster advertising information, only they gently press the button on the left side of the phone, not only to facilitate the user and can increase the revenue of the site.

Let's say we want to create a looping banner ad and put it on top of any page, using ASP and WML to create this page. To make this system more scalable and closer to reality, I want to put the advertising information that will be displayed in the database, and then extract all the relevant information from the database, so that the resulting content remains dynamic. Then randomly select an ad from the database and the link it points to to make the ad cycle appear. Each time a page is loaded, a new advertisement will appear.

Okay, let me start by saying, create an ad database. To simplify, I used the Microsoft Access database, which is named Adbase, which has a primary key Bannerid (used to describe the banner ad name), BannerText (the advertising word displayed on the phone, the actual body message of the banner AD), and Bannerurl (link to the ads) of course, you can also add some graphics to the Web page, but I'll skip the graphics for simplicity. The built libraries are shown below.

<% @Language =vbscript

' Defines the maximum value used to produce random numbers
Maxnoads = 10

' Set Document type
Response.ContentType = "TEXT/VND.WAP.WML"

' Randomly select an ad from the database
Randomize (CByte (Right (Time (), 5), 2))
Adid= (Int (maxnoads-1+1) * Rnd + 1))

' Take this ad out of the database

Set objconn = Server.CreateObject ("Adodb.connection")
objConn.Open "Dsn=adserver;uid=adserver"
sql = "SELECT * from adbase where Bannerid = '" & Adid & "'"
Set rsad = objConn.Execute (SQL)

' Show WML content
%>
>
! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en"
"Http://www.wapforum.org/DTD/wml_1.1.xml" >


" > <%=rsad ("BannerText")%>





Well, this constitutes a banner advertising embryonic form, the following is perfect it, as long as in any you want to add Ads page, add a

The!--#include file= "bannerad.asp"-->.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.