sujithtm
sujithtm

Reputation: 31

Tag Issue in C#

//This code will print the as per the request.
Response.Write("<<<<<<<=======>>>>>>>>>>");

//In this case its not writing as per the request.
Response.Write("<<<<<<<hello======>>>>>>>>>>");

Here in this case its print only <<<<<<>>>>>>>>>.Means it removes the all text,associated all = symbols.

Whats this issue?I just write the text only.But not getting.

Anyone knows this..help me?

Upvotes: 0

Views: 118

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1063884

That isn't html (or xml). The < / > should be escaped to &lt; / &gt;. To avoid mistakes etc (as the contents change), best to use a utility method:

string s = "<<<<<<<hello======>>>>>>>>>>";
Response.Write(HttpUtility.HtmlEncode(s));

Upvotes: 3

Ramesh
Ramesh

Reputation: 13266

I believe the <hello is treated as a tag. I would recommend to use

Response.Write(HttpUtility.HtmlEncode("<<<<<<<hello======>>>>>>>>>>"));

Upvotes: 6

Related Questions