When I have this in my view
<a href="../Product/Category/<%= Html.Encode(item.Category) %>/Default.aspx?partial=False">
<%= Html.Encode(item.Category)%></a>
It renders as expected in IE8 & FF
<a href="../Product/Category/Sauces%20&%20Toppings/Default.aspx?partial=False">
Sauces & Toppings</a>
but does not render correctly in IE7
<a href="../Allergen/Category/Sauces & Toppings/Default.aspx?partial=False">
Sauces & Toppings</a>
Specifically, it appers IE7 is decoding the href property value.
How do I 开发者_运维技巧get IE7 to render the encoded href?
You're using the wrong encoding.
You need to call Html.AttributeEncode(Url.Encode(item.Category))
.
精彩评论