ASP.NET MVC3/Razor.
I found that when I create an action link, say, like this:
@Html.ActionLink(product.Title, "Detail", "Products", new { id = product.ProductID }, null)
The MVC3 engine creates my product link. For example:
http://myhost/{ActionUrl}/PRODID
However, if my product ID was to contain any special character, it wouldn't be URL encoded.
http://myhost/{ActionUrl}/PROD/ID
Of course, this breaks my routing. My questions are:
- Should I expect it to automatically url encode values? Is there any way to set that up?
- If not, then what is the most cleaner way to encode and decode those? I really do not want to do that in every controller.
Thanks!