【发布时间】:2019-04-04 05:00:22
【问题描述】:
我正在使用 WEB API 2。每当有人试图将脚本插入我的 API 时,我想用自定义消息抛出 404 或 400 错误,而不是 500 错误。
这与 SO 问题不同 - Getting "A potentially dangerous Request.Path value was detected from the client (&)" 因为我不想允许,而是抛出自定义错误。
基本上,如果可能的话,我只想在检测到脚本时返回,而不执行任何控制器。
【问题讨论】:
标签: c# asp.net asp.net-web-api asp.net-web-api2 xss