Web Forms Routing not having correct path to images, css, scripts ...

Posted by feronovak on Stack Overflow See other posts from Stack Overflow or by feronovak
Published on 2010-05-18T09:10:21Z Indexed on 2010/05/18 9:21 UTC
Read the original article Hit count: 214

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about .NET

Related posts about routing