views:

14

answers:

1

Hello,

I am trying to use new .net 4.0 Routing for Web Forms with mixed success.

    protected void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes(RouteTable.Routes);

    }

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute(
            "", "article/{id}/{title}", "~/ar.aspx", true, new RouteValueDictionary{{"id", "[0-9]*"}, {"title", ""}}
        );  
    }

Routing as such works well on a local machine as well as a remote server. However, I am unable to find out how to set up routing in such a way that server ignores routing for images, css and scripts so it will be read as http://address/css/text.css instead of http://address/article/1212/some-text/css/text.css

The only way I can make this work if I put tag into but I am sure it can be done other way.

I would appreciate any help on this topic.

Fero

A: 

You should have an additional final Home route that routes everything that is not article/

ondesertverge
Would this additional Home route make every image, css, script in ar.aspx page to use original path ?
feronovak
The routes work in a fall through fashion. If it not caught with `article/` it continues down the path. Try using http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
ondesertverge