string myContent="Hello"
System.Web.UI.Webcontrols.Literal literal1=new System.Web.UI.Webcontrols.Literal();
literal1.Text="<b>" + myContent + "</b><table><tr><td>HI</td></tr></table>" ;
But here I am in a situation where I must perform encoding on literal control text value (The reason is to prevent the literal control from XSS attack.). I am using asp.net c#.
So what I did is,
literal1.Text= AntiXssEncoder.HtmlEconde("<b>" + myContent + "</b><table><tr><td>HI</td></tr></table>");
So the output would be,
<b>Hello</b><table><tr><td>HI</td></tr></table>
I don't want the above output(plain text of my markupt) when I do encoding. I want it to render as
Hello
"HI-> should have been printed inside a html tag "
Also I know that the result of the literal control will be just a plain text If I do encoding on the literal control. I want to encode the literal control plus I don't want my literal control's text to render as a plain text. any help would be appreciable.