ASP.NET
  Home arrow ASP.NET arrow Page 3 - 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 - The Member Center: the siteUser.aspx page


    (Page 3 of 5 )

    The siteUser.aspx page serves as the member center for the website owner, where you can view your ad-related data, as well as obtain the ad code (which directs you as to where and how to put the code inside your own web page to advertise your products). Figure 2 indicates one of the running time snapshots of the page.


    Figure 2—The siteUser.aspx page serves as the member center of the website owner

    The whole layout of the page is simple, with a GridView control to display the ad- related data and a TextBox control (with the TextMode attribute set to MultiLine) to show the ad code.

    Next, let’s take a quick look at the code behind the above page, as follows:

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

    {

    public string code = "";//the ad code

    protected void Page_Load(object sender, EventArgs e)

    {

    if (!User.Identity.IsAuthenticated) Response.Redirect("login.aspx");//if not logged in, then go to page login.aspx

    code = "<script type ="text/javascript" >var username='"+ User.Identity.Name+"'";

    code+= "; </script><script type="text/javascript" src="js/getad.js"></script>";

    TextBox1.Text = code;

    string username = User.Identity.Name;//the user account

    Sql s = new Sql();

    //get the user's ad popularizing related data and show them

    GridView1.DataSource = s.getMyDataSet("select * from hit where username='"+username +"'");

    GridView1.DataBind();

    }

    }

    Here, if the current user has not logged in, then he is redirected to the "Login.aspx" page; otherwise, the code sets up the contents of the TextBox control with the hard-coded script, and then obtains the current user specific ad data and shows it inside the GridView control. That’s all.

    Next, let’s look at the system administrator-related pages.

    More ASP.NET Articles
    More By Xianzhong Zhu


       · 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