title: ASP.NET 3.5 Url Routing Not Working
body: <p>I am a newbie to asp.net field and having some problem in implementing url routing in asp.net 3.5 (I know it can be easily implemented in asp.net 4.0).</p>
  
  <p>Here is what I have done.....</p>
  
  <p>a)  I am using .NET Framework 3.5 SP1.</p>
  
  <p>b)  Added <code>System.Web.Routing</code> assembly reference in <code>web.config</code></p>
  
  <pre><code>&lt;assemblies&gt;
     &lt;add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, 
  PublicKeyToken=31BF3856AD364E35"/&gt;
  &lt;/assemblies&gt;
  </code></pre>
  
  <p>c)  Add the <code>UrlRoutingModule</code> HTTP Module </p>
  
  <pre><code>&lt;httpModules&gt;
  &lt;add name="RoutingModule" 
       type="System.Web.Routing.UrlRoutingModule, System.Web.Routing,
           Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
  &lt;/httpModules&gt;
  </code></pre>
  
  <p>d)  Code in <code>Global.asax</code></p>
  
  <pre><code> void Application_Start(object sender, EventArgs e) 
   {
  
      RegisterRoutes();
   }
  
   private static void RegisterRoutes()
   {
      System.Web.Routing.RouteTable.Routes.Add(
              "SaveUser", new System.Web.Routing.Route("SaveUser",
                                  new RouteHandler("~/Register.aspx")));
  
   }
  </code></pre>
  
  <p>e)   <code>RouteHandler.cs</code> Class</p>
  
  <pre><code> using System;
   using System.Collections.Generic;
   using System.Linq;
   using System.Web;
   using System.Web.Routing;
   using System.Web.Compilation;
   using System.Web.UI;
  
   public class RouteHandler : IRouteHandler
   {
     public RouteHandler()
     {
     }
  
     public RouteHandler(string virtualPath)
     {
        _virtualPath = virtualPath;
     }
  
     public IHttpHandler GetHttpHandler(RequestContext requestContext)
     {
         //var display = BuildManager.CreateInstanceFromVirtualPath(
         //                _virtualPath, typeof(Page)) as IDisplay;
         var abc = BuildManager.CreateInstanceFromVirtualPath(_virtualPath, typeof(Page)) as IDisplay;
         return abc;
     }
  
     string _virtualPath;
  }
  </code></pre>
  
  <p>f)  Code in <code>Default.aspx.cs</code></p>
  
  <pre><code> using System;
   using System.Configuration;
   using System.Data;
   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 partial class _Default : System.Web.UI.Page 
   {
     protected void Page_Load(object sender, EventArgs e)
     {
        Response.Redirect("~/SaveUser");
     }
   }
  </code></pre>
  
  <p>and I am getting the following error</p>
  
  <blockquote>
    <p>The route handler 'RouteHandler' did not return an <code>IHttpHandler</code>
    from its <code>GetHttpHandler()</code> method.</p>
  </blockquote>
  
  <p>I tried 100 of links but could not make out what is wrong.</p>
  
  <p>If anyone have experience in url routing in asp.net 3.5.....pls help.... I need to implement it very urgently....</p>
  
  <p>Thanks in advance....</p>