Howto allow "Illegal characters in path" ?
Posted
by hbruce
on Stack Overflow
See other posts from Stack Overflow
or by hbruce
Published on 2010-01-18T15:51:33Z
Indexed on
2010/05/21
23:30 UTC
Read the original article
Hit count: 373
asp.net-mvc
|routing
I have a MVC.NET application with one route as follows:
routes.MapRoute("member", "member/{id}/{*name}", new { controller = "member", action = "Details", id = "" }, new { id = @"\d+" });
Thus, a link could be something like this: http://domain/member/123/any_kind_of_username
This works fine in general but if the path contains illegal characters (e.g. a double qoute: http://domain/member/123/my_"user"_name) I get a "System.ArgumentException: Illegal characters in path."
After much googling the best suggestions seems to be to make sure that the url doesn't contain any such characters. Unfortunately, that is out of my control in this case.
Is there a way to work around this?
© Stack Overflow or respective owner