locked
HtmlTextWriter and HtmlEncoding RRS feed

  • Question

  • User-1450176746 posted

    I have written a control that provides a wrapper around a flash control object. In my overridden Render, I am writing out OBJECT and PARAM elements. In the values of one of the param elements I am required to dump a list of image URLs. The problem is HtmlTextWriter is obviously HtmlEncoding the string which causes any URLs that have an '&' to be output as '&'. I've tried using HtmlUtility.UrlEncode around the string but it didn't work. Is there anyway I can tell HtmlTextWriter not to HtmlEncode at this point?

     Regards,

    Wednesday, July 30, 2008 6:00 AM

Answers

  • User-1450176746 posted

    I've solved my problem. The method of HtmlTextWriter, AddAttribute provides an override that takes an extra boolean fEncode which I set to false.

     HtmlTextWriter.AddAttribute(string name, string value, bool fEncode)

     Cheers.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 30, 2008 9:07 AM