Wednesday, May 7, 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;}

}}

 

No comments :

Post a Comment

AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath