How to mask tilde (~) character in C# MVC routing table?
- by AC
I'm moving my home-baked web site to MVC and got the trouble with url routing. The site already serves several links that contain tilde (~) character in the path; something like
http://.../~files/...
http://.../~ws/...
and I want each of them are handled by separate controller, like filesController, wsController, so my route table looks like
routes.MapRoute( "files", "~files/{*prms}", new { controller = "files", action = "index", prms = "" } );
routes.MapRoute( "ws", "~ws/{*prms}", new { controller = "ws", action = "index", prms = "" } );
...
but when I try to get the result I got the error saying "The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character."
As I understand those characters have the special meaning in ASP.net but is it possible to mask them somehow, at least tilde? Should I parse and route requests like this myself? What the best practice to handle urls like this?
Thanks!