ASP.NET
  Home arrow ASP.NET arrow Page 5 - Completing an In-Text Advertising System u...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Completing an In-Text Advertising System under an ASP.NET 3.5 Environment
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2009-01-28

    Table of Contents:
  • Completing an In-Text Advertising System under an ASP.NET 3.5 Environment
  • The Verification Code
  • The Member Center: the siteUser.aspx page
  • Manage the Ad Keywords
  • Manage the Ad Contents

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Completing an In-Text Advertising System under an ASP.NET 3.5 Environment - Manage the Ad Contents


    (Page 5 of 5 )

    If you click the "Go to manage the AD contents" hyperlink at the top of the "Admin1.aspx" page, you will be navigated to the "Admin2.aspx" page, where you can manage the specified keyword-related ad contents—browse, add, and delete some items. Figure 4 indicates the running time snapshot of the "Admin2.aspx" page.


    Figure 4—Admin2.aspx: managing the ad contents

    As you’ve seen from the figure, there are one-to-many relationships between the ad keywords and the contents. For example, the CSS keyword is bound to two items of content: "google" and "search engine." The basic coding logic of this page quite resembles that of the "‘Admin1.aspx" page. Here we only give the server-side code related to the "Admin2.aspx" page:

    public partial class admin2 : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    //not logged, then force to login first

    if (Session["admin"]==null||Session["admin"].ToString() != "true") Response.Redirect("login.aspx");

    if (!IsPostBack)

    {

    myDataBind();//data binding

    }

    }

    //paging

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)

    {

    GridView1.PageIndex = e.NewPageIndex;

    myDataBind();

    }

    //delete

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

    {

    if (e.CommandName == "del")

    {

    string id = e.CommandArgument.ToString();

    try

    {

    Sql s = new Sql();

    s.ExecuteSql("delete from ad where id=" + id);//delete

    myDataBind();

    }

    catch

    { }

    }

    }

    //datasource binding

    private void myDataBind()

    {

    Sql s = new Sql();

    string str = "select ad.*,keyarray.name from ad inner join keyarray on ad.keyid=keyarray.id order by ad.id desc";

    DataSet ds = s.getMyDataSet(str);//add the ad contents

    GridView1.DataSource = ds;

    GridView1.DataBind();

    }

    //add the ad content

    protected void Button1_Click(object sender, EventArgs e)

    {

    int result;

    Sql s = new Sql();

    //add the ad content

    result =s.ExecuteSql("insert into ad(keyid,description,url) values('"+ DropDownList1.SelectedValue +"','"+ TextBox2.Text+"','"+ TextBox1.Text+"')");

    string msg = "alert('Operation failed!')";

    if (result == 1)//if peration succeeded,then prompt

    {

    TextBox2.Text = TextBox1.Text = "";

    msg = "alert('Operation succeeded!')";

    myDataBind();

    }

    //the client side prompt

    ClientScript.RegisterStartupScript(this.GetType(), "asdf", msg, true);

    }

    }

    In the above code, we’ve also provided enough comments. So we won’t waste any more words on details.

    Summary

    In-text advertising is a new form of advertising through the Internet. In this series of articles, we have constructed a simple in-text ad system. Despite its simplicity, we’ve given you the basic idea and the core routine involved in developing a real-life in-text ad application. And of course, due to its simplicity, it has numerous points that need to be perfected. For example, in practical systems, you’d better add the following supports:

    1. Make the user center for the advertisers facilitate the placing of ads as well as allow them to view their own advertising effects.

    2. Provide support for preventing practical fraud and spiteful clicking so as to insure the correctness of the system.

    3. Add support for the on-line payment so as to facilitate the advertisers in adding ad rates for their ads online, and enable the website owners to obtain their own ad income in the online mode.

    4. Categorize the websites and ad keywords. For example, you can have some specified category-related websites which can only exhibit ad keywords relating to this category. The final aim is to better the effect of the advertisement.

    -DOWNLOAD SOURCE-


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This is a very good article. Is there going to be another part to this series?
     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek