Prevent encoding of attribute in a html element.

Vote:
 

Hi,

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?

#56704
Feb 03, 2012 11:15
Vote:
 

Trying to paste the code again: <img src="<%= AdTractionUrl %>" width="1" height="1" />

#56705
Feb 03, 2012 11:16
Vote:
 

<%= AdTractionUrl %> won't be encoded, at least not by the binding expression. Are you sure you're not encoding this when setting the property?

#56728
Feb 06, 2012 10:37
Vote:
 

That's right, the problem was not an encoding issue. It was my browser that encoded the url in view-source.

#56738
Feb 07, 2012 7:50
Vote:
 

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)? 

#56743
Feb 07, 2012 11:38
Vote:
 

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:

<esi:when test="$exists($(HTTP_COOKIE{'mycookie'}))">

    

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?

#82138
Mar 05, 2014 20:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.