How to get asp.net so that unescape automatically avoids URL skew?

With a url like http://abc.com/myid/ab%2fcd (where% 2f is a forward slash), asp.net will override% 2f, so that is from the point of view of my application (and from the point of view of asp .net mvc) URL: http://abc.com/myid/ab/cd

Since my application uses asp.net mvc, this behavior can easily cause routing problems if I want the route to specify something like "/ myid / {id}", since unescaping asp.net will cause the route to not will match.

According to the answer to this question: slash in the url and according to this msdn page: http://msdn.microsoft.com/en-us/library/ee656542.aspx the solution (in .Net 4.0) should put following in your web.config:

<uri> <schemeSettings> <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/> </schemeSettings> </uri> 

But I can not get it to work - "% 2f" still does not automatically appear in "/". Does anyone know why config configuration might not work for me or any other suggestions?

+7
source share
1 answer

A simple solution is to use the catch-all token, for example. {controller}/{action}/{*id}

+5
source

All Articles