开发者

What is Server.HtmlEncode()?

开发者 https://www.devze.com 2023-04-13 09:05 出处:网络
What is the difference between using and not using Server开发者_开发问答.HtmlDecode()? For example:

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消