Finally I close the customErrors
<customErrors mode="Off"></customErrors>
Then I use httpErrors to replace it.
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="400"/>
<error statusCode="400" responseMode="ExecuteURL" path="/Error/BadRequest"/>
<remove statusCode="403"/>
<error statusCode="403" responseMode="ExecuteURL" path="/Error/AccessDenied" />
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
<remove statusCode="500"/>
<error statusCode="500" responseMode="ExecuteURL" path="/Error/Error" />
</httpErrors>
Now All fine.
Update 1
But it will display the exception details sometimes , So now I use :
<customErrors mode="RemoteOnly" defaultRedirect="~/Main/Error" redirectMode="ResponseRewrite">
<error redirect="~/Main/NotFound" statusCode="404" />
<error redirect="~/Main/Error" statusCode="500" />
<error redirect="~/Main/AccessDenied" statusCode="403" />
<error redirect="~/Main/BadRequest" statusCode="400" />
</customErrors>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="400" />
<error statusCode="400" responseMode="ExecuteURL" path="/Main/BadRequest" />
<remove statusCode="403" />
<error statusCode="403" responseMode="ExecuteURL" path="/Main/AccessDenied" />
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/Main/NotFound" />
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/Main/Error" />
</httpErrors>
I think still not find best solution for now. also don't understand why the Microsoft design like that. Maybe want every one know the website based on .NET
Already answer
link. – Faintheart