A potentially dangerous Request.Form value was detected from the client

前端 未结 30 2270
刺人心
刺人心 2020-11-21 05:24

Every time a user posts something containing < or > in a page in my web application, I get this exception thrown.

I don\'t want to go

30条回答
  •  青春惊慌失措
    2020-11-21 05:55

    You could also use JavaScript's escape(string) function to replace the special characters. Then server side use Server.URLDecode(string) to switch it back.

    This way you don't have to turn off input validation and it will be more clear to other programmers that the string may have HTML content.

提交回复
热议问题