1

enter image description here[![enter image description here][2]][2]

In below picture how to avoid showing of framework versions in default error message by IIS?

  • 1
    You should provide your own custom error pages and suppress all the of the ASP.NET generated error pages. There are several options for this. Look for "custom error ASP.NET" with your favorite search too. – Flydog57 Feb 12 '19 at 19:12
  • it's an api. I can not show any pages. do i need to show some custom error response? – Naresh Garlapati Feb 12 '19 at 19:18
  • @NareshGarlapati yes create a custom response – lloyd Feb 12 '19 at 19:25
  • Catch exceptions (either locally or with a registered handler) and return something (whatever makes sense in your API) to the caller with an HTTP status of 500. – Flydog57 Feb 12 '19 at 19:47
  • Possible duplicate of [A potentially dangerous Request.Path value was detected from the client (\*)](https://stackoverflow.com/questions/5967103/a-potentially-dangerous-request-path-value-was-detected-from-the-client) – Vijunav Vastivch Feb 13 '19 at 06:25
  • Note that you should also update the iis config to remove the headers like X_PoweredBy (something like that) which says it's coming from dotnet – Brian White Feb 14 '19 at 03:09
  • Other reason to return custom response - right now someone is calling your API expecting xml or json, and they're getting an html page instead. Causes all kinds of client parsing issues – Brian White Feb 14 '19 at 03:10

1 Answers1

0

In below picture how to avoid showing of framework versions in default error message by IIS?

As far as I know, if you set the custom error's mode attribute to On or remoteonly in the web.config. It will hide the details information for the error message and framework versions in default error message by IIS like below:

enter image description here

There is no need to hide the framework versions when you debug the whole application in the server, since customer will not see the details error message.

yes create a custom response

If you want to create a custom error handler for asp.net web api, I suggest you could try to create a class inherits ExceptionFilterAttribute and overried the OnException method.

More details, you could refer to below answer's error handling part.

https://stackoverflow.com/a/22163675/7609093

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65