Search code examples
sharepointsharepoint-2007mossasp.net-routing

Using ASP.Net 3.5 SP1 Routing with SharePoint 2007


I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net 2.0 friendly URLs using RewritePath, but I was wondering if it was possible to make use of the System.Web.Routing that comes with ASP.NET 3.5 SP1.

I think I've figured out how to get my route table loaded, but I'm not clear on what method to use to get the correct IHttpHandler to pass out.

Thanks!


Solution

  • I ended up taking what Ryan had:

    var route = new Route("blah/{*path}", new MyRouteHandler());
    RouteTable.Routes.Add(route);
    public class MyRouteHandler : IRouteHandler
    {    
    public IHttpHandler GetHttpHandler(RequestContext requestContext)    
    {        
         //rewrite to some know sharepoint path
         HttpContext.Current.RewritePath("~/Pages/Default.aspx");
    
         // return some HTTP handler here  
         return new DefaultHttpHandler();  
    
    }}
    

    That seems to work ok for me.