This
article demonstrates how to use the AdRotator control to display advertisements
in an ASP.NET Web site and how to implement custom "click tracking" logic. Many
e-commerce sites use banner advertisements to promote products and services on
behalf of customers. The AdRotator control allows developers to place graphical
advertisements on a Web Form and provides programmatic functionality that
enables the development of custom logic to track advertisement clicks. The
AdRotator randomly select banner graphics from a list that is specified in an
external XML.
First of
all
Start Visual Studio .NET. And make a new ASP.NET Web Site using visual studio
2008.
Figure 1.
Add a new
XML File.
Figure 2.
Put this
code .XML File.
<?xml
version="1.0"
encoding="utf-8"
?>
<Advertisements>
<Ad>
<ImageUrl>~/Banners/468X60_add.gif</ImageUrl>
<NavigateUrl>http://www.Mindcracker.com/Registration/Register.aspx</NavigateUrl>
<AlternateText>Advertisement</AlternateText>
<Impressions>100</Impressions>
<Keyword>Header</Keyword>
<Category>Script</Category>
</Ad>
<Ad>
<ImageUrl>~/Banners/468X60_Consultant.gif</ImageUrl>
<NavigateUrl>http://www.mindcracker.com/Consultants/</NavigateUrl>
<AlternateText>Advertisement</AlternateText>
<Impressions>100</Impressions>
<Keyword>Header</Keyword>
<Category>Script</Category>
</Ad>
<Ad>
<ImageUrl>~/Banners/468X60_Employer.gif</ImageUrl>
<NavigateUrl>http://www.Mindcracker.com/Registration/Register.aspx</NavigateUrl>
<AlternateText>Advertisement</AlternateText>
<Impressions>100</Impressions>
<Keyword>Header</Keyword>
<Category>Script</Category>
</Ad>
<Ad>
<ImageUrl>~/Banners/468X60_Jobseeker.gif</ImageUrl>
<NavigateUrl>http://www.mindcracker.com/Jobs/</NavigateUrl>
<AlternateText>Advertisement</AlternateText>
<Impressions>100</Impressions>
<Keyword>Header</Keyword>
<Category>Script</Category>
</Ad>
<Ad>
<ImageUrl>~/Banners/468X60_Recruiter.gif</ImageUrl>
<NavigateUrl>http://www.Mindcracker.com/Registration/Register.aspx</NavigateUrl>
<AlternateText>Advertisement</AlternateText>
<Impressions>100</Impressions>
<Keyword>Header</Keyword>
<Category>Script</Category>
</Ad>
</Advertisements>