Reputation: 31
//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
Reputation: 1063884
That isn't html (or xml). The <
/ >
should be escaped to <
/ >
. To avoid mistakes etc (as the contents change), best to use a utility method:
string s = "<<<<<<<hello======>>>>>>>>>>";
Response.Write(HttpUtility.HtmlEncode(s));
Upvotes: 3
Reputation: 13266
I believe the <hello is treated as a tag. I would recommend to use
Response.Write(HttpUtility.HtmlEncode("<<<<<<<hello======>>>>>>>>>>"));
Upvotes: 6