利用方法HttpUtility.HtmlEncode来预处理用户输入。这样能阻止用户用链接注入JavaScript代码或HTML标记,比如//Store/Broswe?Genre=<script>window.location='www.kinpor.com'</script>

示例:

1 public string Broswe(string genre)
2 {
3     var message=HttpUtility.HtmlEncode("Store.Broswe, Genre = " + genre);
4     return message;
5 }

 

相关文章:

  • 2021-07-07
  • 2021-08-09
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2022-12-23
  • 2021-05-21
猜你喜欢
  • 2021-11-11
  • 2021-11-16
  • 2022-12-23
  • 2021-12-06
  • 2022-02-10
相关资源
相似解决方案