ContentResult vs. string

后端 未结 6 1414
-上瘾入骨i
-上瘾入骨i 2020-12-29 01:37

I recently was asked why to use ContentResult instead of returning string. Unfortunately I could not give a better answer than: \"It is best practi

6条回答
  •  粉色の甜心
    2020-12-29 02:25

    Returning a ContentResult helps protect your application.

    E.g If your application allows input from users, a malicious user might try to parse a javascript text. This will prevent javascript from executing in your application

提交回复
热议问题