As Like Application Start event the below code will works,but this will execute for each and every user login.
Copy and paste in a Class File
-----------------------------
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public class UrlRewrite : System.Web.IHttpModule 
{
    HttpApplication _application = null;
    public UrlRewrite()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public void Init(System.Web.HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_UrlRewrite);
    }
    
    private void context_UrlRewrite(object sender, EventArgs e)
    {
      //Your Code
    }
    public void Dispose()
    {
    }
}
Add the below tag in a WebConfig
--------------------------------
<httpModules>
 <add name="UrlRewrite" type="UrlRewrite,App_Code"/>
</httpModules>
Note: Make sure that given the Class Name.
 <add name="ClassName" type="ClassName,App_Code"/>
Thursday, March 11, 2010
Subscribe to:
Post Comments (Atom)
1 comment:
hm..GREAT man.......:)
Post a Comment