click count on image using generic handler

Posted on May 7, 2008.

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/120×240-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;}

}}

 

 

Make a Comment

Make A Comment: ( None so far )

blockquote and a tags work here.

    About

    hi,i am suresh sharma from Gorakhpur , UP, India.I have work on .net technology from 2 years. Key skills-Asp.net 2.0,3.5, Sql 2005,2000. Ajax.net 1.1,C#.net

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS
    • Subscribe in Rojo

    Meta

Liked it here?
Why not try sites on the blogroll...