ASP.NET MVC routing issue: How to allow "\" in id's

Posted by Bipul on Stack Overflow See other posts from Stack Overflow or by Bipul
Published on 2011-01-03T04:44:43Z Indexed on 2011/01/03 4:53 UTC
Read the original article Hit count: 227

Filed under:
|
|

I am using following route map

    routes.MapRoute(
        "RenderAssociatedForm",
        "DoAction/{nodeLevelId}/{nodeSystemId}",
        new
        {
            controller = "FrontEnd",
            action = "RenderAssociatedForm",                    
        });

Now nodeLevelId can be anything like zs\bbal. As we know that we should escape '\', so we are using 'zs%5cbbal'. But still the following url is not mapping to this route.

//localhost/DoAction/zs%5cbbal/5

When I try simple Id without the escape character, it maps properly. Can anybody tell me where I am going wrong?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about routing