Example of Literal Control Mode Properties in C#

protected void Page_Load(object sender, EventArgs e) 
{ 
    Literal 1.Text =@"This is an <font size=7>example</font>"+ 
      "<script>alert(""This is Literal 1""); </script>"; 
    Literal 2.Text =@"This is an <font size=7>example</font>"+ 
      "<script>alert(""This is Literal 2""); </script>"; 
    Literal 3.Text =@"This is an <font size=7>example</font>"+ 
      "<script>alert(""This is Literal 3""); </script>"; 
    Literal 1.Mode = LiteralMode.Encode; 
    Literal 2.Mode = LiteralMode.PassThrough; 
    Literal 3.Mode = LiteralMode.Transform;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.