Xpode.com        Click here to Print this article.

What should we do if we call http://default.xyz page so that it would redirect to http://default.aspx page. OR What is URL Rewriting.

Step 1:

 

      Create the following class in APP_CODE folder

 

                 public class MyTest : IHttpHandler

{

      public bool IsReusable

    {

        get

        {

            return false;

        }

    }

 

    public void ProcessRequest(HttpContext ob)

    {

        ob.Response.Redirect("Default.aspx");

    }

}

               

                Step 2:

 

      Modify the web.config file to include below line:

                 < add verb = "*"path="*.xyz"type="MyTest" />

                

                It should be added under <system.web>  <httpHandlers>  tags like:

 

                < httpHandlers >

< add verb = "*"path="*.asmx"validate="false"type="System.Web.Extensions,

System.Web.Extensions, Version=3.5.0.0, 

                  Culture=neutral, PublicKeyToken=31B35 "/>

            < add verb = "*"path="*.xyz"type="MyTest" />

</ httpHandlers >

 






Contributed by:
Guest
Guest user is that user who have done some activity on website without login. Activity contains commenting on any article, uploading an image on website etc.

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=183

Click here to go on website