I would like to develop a url that looks like this:
http://mysite.com/products/1/best-product-in-the-world
Where I need to get to the desired record, the following route:
http:
When I add the product description detail to the URL ("the best product in the world"), I get problems with the URL encoding. I tried using Server.UrlEncode when constructing this part of my URL in ActionLink (...):
<%= Html.ActionLink(item.Subject, "../Post/Detail",
new { id = item.ID,
descriptiveUrl = Server.UrlEncode(Product.ShortDescription) },
new { rel = "canonical",
title = Product.ShortDescription,
@class = "product-hyperlink" })%>
But it does regular coded elements for special characters and spaces, like the following:
http:
... which creates an exception of 400, is a bad call. I’m not sure that I raised the question of justice, but can provide additional clarifications if necessary.
Refresh : This url looks like this and I'm trying to do something very similar.
http://stackoverflow.com/questions/1148955/creating-search-engine-friendly-urls-in-asp-net-mvc