What is the difference between using and not using Server开发者_开发问答.HtmlDecode()
?
For example:
txtLocation.Text = Server.HtmlDecode(awardShowYear.ShowLocation);
txtLocation.Text = awardShowYear.ShowLocation;
What is the difference between those two lines of code?
The first one:
txtLocation.Text = Server.HtmlDecode(awardShowYear.ShowLocation);
Will remove any HTML-Encoding from the string and assign the decoded result to the txtLocation.Text.
The second one:
txtLocation.Text = awardShowYear.ShowLocation;
Will simply assign the string to txtLocation.Text, preserving any HTML encoding that is present.
See HttpServerUtility.HtmlDecode Method (String)
精彩评论