asp.net-mvciis-10

Handle "A potentially dangerous Request" in IIS


I have hosted an MVC web application in my local system. When my application was tested using a VAPT tool by external Auditors, they discovered an error when they accessed the application using the following URL : https://10.25.71.117/uncpath/<script>alert("123")</script>.

The error is:

"A potentially dangerous Request. Path value was detected from the client (<)."

Here my application is not uncpath. As my application itself is called, I want to handle the error through IIS server. For that I need to know the Error status code for this kind of requests and handle it using a custom error.

Unhandled Error


Solution

  • I think you want something like Custom error pages:

    If you try but fail to implement, feel free to post your attempt(s) here and their results.