Tuesday, 6 May 2008

click count on image using generic handler

hi

if u want to count on clicking image u just use generic hander in asp.net like that

<a href="Handler.ashx?bid=d1&Al=right&url=excelexp.aspx" ><img src="Images/120x240-wc.gif" /></a>

and in Handler.ashx page u write program for count . and store in database or in xml file.
<%@ WebHandler Language="C#" Class="Handler" %>




using


System;


using System.Web;

 public class Handler : IHttpHandler {

 public void ProcessRequest (HttpContext context)

 {context.Response.ContentType = "text/plain";

string align=context.Request.QueryString["Al"];

string url = context.Request.QueryString["Url"];

//here u write your counting code and store in database or in xml file

context.Response.Redirect(url, true);

context.Response.End();

}

public bool IsReusable {

get {return false;}

}}

 

Share:

0 Comments:

Post a Comment