ASP.net Literal or Page altering HTML string, causing formatting issues

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-06-16T12:20:43Z Indexed on 2010/06/16 12:22 UTC
Read the original article Hit count: 291

Filed under:
|
|

We have a service that generates a report (using word templates and a 3rd party library), and then returns a string in HTML. While this HTML isn't great - its formatted correctly in this string.

We want this HTML to show up on a page - format intact. What we currently have done is set an ASP.net Literal's text element to this string.

While this works, I have noticed that it has reformatted the HTML string slightly. For the most part, it looks like it generated a bunch of new CSS classes, and a new style element in the HTML. This HTML does not exist in the string thats being returned. I could filter all of this back out, but wonder if there is a better way.

I assume that the Page itself is altering something.

What is the best way to display this raw HTML back to the user? I can't directly use a Response.Write(string), because this page does have a few other controls on it.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about formatting