In my asp.net mpc application, I created the following link:
http://localhost:2689/en/Formula.mvc/351702++LYS+GRONN+5G+9%252f2++fds
I get error 400 (bad request).
I think it is blocking at% 25 (slash).
What am I doing wrong?
- EDIT 3 -
I tried not to encode anything at all, but rather relied on the default encoding Url.RouteUrl ().
It seems that for some reason this does not encode "/".
If I encrypt it first, I get code with double value% 252f. For some reason this gives me a bad request .. Why?
- EDIT 2 -
I generated the last part of the URI as follows:
- Take id.toString
- Take HttpUtility.UrlEncode (name)
- Take HttpUtility.UrlEncode (code)
- String.Format ("{0} - {1} - {2}") with the values ββfrom the previous parts
- Add it as a parameter to Url.RouteUrl ()
After that, my action again receives this parameter, splits it into - and HttpUtility.Decode () values ββback.
I do it this way because the last two parameters are optional but functional parameters. If they are defined in the previous step, they must be transferred to other pages.
Less abstract: a color can have several names, but if the user selected it by a specific name, it should be stored on all other pages.
- EDIT 1 -
It also looks like this: HttpUtility.UrlEncode () and Url.Encode () return different results: S
If I don't encode "/", it acts as a delimiter => no luck. If I encode it using Url.Encode (), I get% 2F => Code 400 If I encode it using HttpUtility.UrlEncode (), I get% 25 => Code 400
Since 400 doesn't even skip it to asp.net-mvc, the route debugger is useless :(