Are there any benefits to using HtmlTextWriter if you are not going to benefit from adaptive rendering?

后端 未结 5 1234
北恋
北恋 2021-02-07 11:17

Outside of benefiting from Adaptive Rendering for alternate devices, does it ever make sense to write all of this code:

writer.WriteBeginTag(\"t         


        
5条回答
  •  抹茶落季
    2021-02-07 11:51

    The biggest reason I can think of is to avoid having to take an extra step to sanitize your input. According to the docs, WriteEncodedText will automatically format any angle brackets appropriately.

    XSS is a real thing, and anything you can do to make it easier for future devs to maintain your code is a benefit.

提交回复
热议问题