Page

Implement Adrotator in ASP.Net

<script  runat="server">
   Sub change_url(sender As Object, e As AdCreatedEventArgs) 
     e.NavigateUrl="http://www.sourcecodernp.blogspot.com" 
   End Sub 
</script>

<!DOCTYPE html>
<html>
<body>

<form runat="server">
<asp:AdRotator AdvertisementFile="Ad1.xml"
runat="server" OnAdCreated="change_url"
target="_blank" />
</form>



Ad1.xml file

<Advertisements>
    <Ad>
        <ImageUrl>D:\images\img1.gif</ImageUrl>
        <NavigateUrl>http://www.sourcecodernp.blogspot.com</NavigateUrl>
        <AlternateText>ASP.NET ADROTATOR</AlternateText>
        <Keyword>A</Keyword>
        <Impressions>Technology</Impressions>
        <Caption>This is the caption for Ad#1</Caption> 
    </Ad>

    <Ad>
        <ImageUrl>D:\images\img2.gif</ImageUrl>
        <NavigateUrl>http://www.sourcecodernp.blogspot.com</NavigateUrl>
        <AlternateText>ASP.NET ADROTATOR</AlternateText>
        <Keyword>S</Keyword>
        <Impressions>Web Site</Impressions>
        <Caption>This is the caption for Ad#2</Caption> 
    </Ad>

    <Ad>
        <ImageUrl>D:\images\img3.gif</ImageUrl>
        <NavigateUrl>AdRotator.aspx?ad=Widgets
               &target=http://msdn.microsoft.com/widgets/</NavigateUrl>
        <AlternateText>www.sourcecodernp.blogspot.com</AlternateText>
        <Keyword>S</Keyword>
        <Impressions>Flash Site</Impressions>
        <Caption>This is the caption for Ad#2</Caption> 
    </Ad>

</Advertisements>

No comments:

Post a Comment