i need to prevent encoding of some attributes and I wonder if there is some easy solution.
The code that is used: <img src="<%= AdTractionUrl %>" width="1" height="1" />
The only thing I can come up with is to write a responsefilter that reverse encoding of the attribute.
Any better solutions?
Trying to paste the code again: <img src="<%= AdTractionUrl %>" width="1" height="1" />
<%= AdTractionUrl %> won't be encoded, at least not by the binding expression. Are you sure you're not encoding this when setting the property?
That's right, the problem was not an encoding issue. It was my browser that encoded the url in view-source.
However, attribute values are supposed to be encoded (for instance bare &'s are not allowed).
Is there really some reason why you'd want it not to be encoded (one would think there'd be less risk of breakage with it properly encoded than not)?
Hijacking this old thread :)
We have a case where we actually have a reason why it shouldn't be encoded: when using Akamai Edge Side Includes, such as this:
It seems that HtmlRewritePipe.WriteElement does encode attribute values, even for elements that it doesn't touch and non-valid HTML elements. Any bright ideas on how to work around this?