I need to build an url like this: /products/myproductdescription/5; it works except when the product description contains a "/". I build the link with razor in this way:
<a href="@Url.Content("/Products/" + @product.Description + "/" + @product.Id)">@product.Description</a>
I thought that using @product.Description would encode the description, but I get a link with the "/" if it is present in the description. I tried this way also:
<a href="@Url.Content("/Products/" + @Html.Encode(product.Description) + "/" + @product.Id)">@product.Description</a>
but the result is the same ... Someone can tell me why that part of the link is not encoded? Thank you.