title: CDATA returns &lt;![CDATA instead of <![CDATA[
body: <p>I have an action in asp.net MVC controller that is returning a serialized object something like this. </p>
  
  <pre><code>public ActionResult Test(int ID)
  {
      var xmlString= Serialize(object);
  
      return this.Content(xmlString, "text/xml");
  
  }
  
  public string Serialize&lt;T&gt;(T obj))
          {
              XmlSerializer ser = new XmlSerializer(typeof(T));
  
              XmlWriterSettings settings = new XmlWriterSettings();
              settings.Encoding = new UnicodeEncoding(false, false); // no BOM in a .NET string
              settings.Indent = true;
              settings.OmitXmlDeclaration = true;
  
              using (StringWriter textWriter = new StringWriter())
              {
                  using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings))
                  {
                      ser.Serialize(xmlWriter, obj);
                  }
                  return textWriter.ToString(); 
              }
          }
  </code></pre>
  
  <p>One of the elements contains <code>&lt;![CDATA[</code> . The problem is that in browser I get <code>&lt;![CDATA[</code> , but in document source code it is displayed as <code>&amp;lt;![CDATA</code></p>
  
  <p>To set cdata value I am using new <code>System.Xml.XmlDocument().CreateCDataSection(tempValue).OuterXml;</code></p>
  
  <p>What could be the problem?</p>