1

I want to use Response.Write to display some text on the screen using ASP.NET I created a variable

String s = "There is some <hidden text> which is not visible";
Response.Write(s);

What I found is when the browser only display "There is some which is not visible" any text written in between symbols '<'......'>' is neglected by the browser.

How can I display entire text?

Please advice.

ks_baba
  • 29
  • 3
  • 11

3 Answers3

2

You can try this:

String s = @"There is some <hidden text> which is not visible";
Response.Write(s);
Ruben de la Fuente
  • 695
  • 11
  • 23
1

I'm not familiar with C# so this might not work, but you can escape the < and > by using html escape characters.

&#60; for <

&#62; for >

So maybe try...

String s = "There is some &#60;hidden text&#62; which is not visible";
domdomcodecode
  • 2,355
  • 4
  • 19
  • 27
1

Use HTML Encoding

Server.HtmlEncode("There is some <hidden text> which is not visible");
Emad Mokhtar
  • 3,237
  • 5
  • 31
  • 49
  • thanks @Emad This also worked when i used it as Response.Write(Server.HtmlEncode("There is some which is not visible");) – ks_baba Mar 09 '14 at 13:21