Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




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 >

 

Share this article   |    Print    |    Article read by 2170 times
Author:
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.
Related Articles: No related article
Related Interview Questions: No related interview question