using System.Web.UI; using System.IO; public void WriteHtml() { StringWriter writer = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(writer); htmlWriter.RenderBeginTag(HtmlTextWriterTag.Html); htmlWriter.RenderBeginTag(HtmlTextWriterTag.Body); htmlWriter.Write("Hello, World!"); htmlWriter.RenderEndTag(); htmlWriter.RenderEndTag(); htmlWriter.Flush(); // flush the output buffer to response }In this example, we are using the HtmlTextWriter to generate HTML markup and writing it to a StringWriter object. We then call the Flush method to send the output to the response. The package library for the System.Web.UI namespace is part of the .NET Framework.