LoginSignup
2
0

More than 5 years have passed since last update.

ASP.NET > 危険な可能性のある Request.Path 値がクライアント (?) から検出されました。の対応

Posted at

現象

WebAPIサービスで以下のようなエラーが表示されました。

image

HTTP Get処理にて?文字(%3F)をURLに含めて送信した事からです。

Request URLの例

http://localhost:61902/api/Translate/en/ja/What%20is%20the%20schedule%20for%20tomorrow%3F

解決方法

2018/7/20 現在、以下の解決法でうまくいきました。
Web.configファイル中の<httpRuntime />requestPathInvalidCharacters=""を追加

<system.web>
    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
...
</system.web>

参考

WebMatrix 3:危険な可能性のある Request.Path 値がクライアント (:) から検出されました。 - だるろぐ

.NET Framework4 / ASP.NET4を導入 | 水無月ばけらのえび日記

ASP.NET 4 URL limitations: why URL cannot contain any %3f characters - Stack Overflow

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0