<%@ WebHandler Language="C#" Class="GetAd" %>

using System;
using System.Web;
using HuiboBll;

public class GetAd : IHttpHandler {

    private string msg = string.Empty;
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        if (!string.IsNullOrEmpty(context.Request.QueryString["type"])) {
            string type = context.Request.QueryString["type"].ToString();
            ad Ad = new ad();
            System.Data.DataSet Ds = new System.Data.DataSet();
            Ds = Ad.GetList("");
            if (type == "tanchu")
            {
                if (Ds.Tables[0].Rows[0]["tanchu"].ToString().Trim() == "1") {
                    msg = Ds.Tables[0].Rows[0]["tanurl"].ToString().Trim() + "!@#$" + Ds.Tables[0].Rows[0]["tanwidth"].ToString().Trim()
                        + "!@#$" + Ds.Tables[0].Rows[0]["tanheight"].ToString().Trim() + "!@#$" + Ds.Tables[0].Rows[0]["tanleft"].ToString().Trim() + "!@#$" + Ds.Tables[0].Rows[0]["tantop"].ToString().Trim();
                }
            }
            else {
                if (Ds.Tables[0].Rows[0]["piaofu"].ToString().Trim() == "1")
                {
                    msg = Ds.Tables[0].Rows[0]["piaofupic"].ToString().Trim() + "!@#$" + Ds.Tables[0].Rows[0]["piaofuurl"].ToString().Trim();
                }
            }
        }
        context.Response.Write(msg);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}