Как я могу получить свою пользовательскую страницу при вводе недопустимого параметра в url
web.config file code <system.webServer> <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" /> <error statusCode="404" responseMode="ExecuteURL" path="/Error/PageNotFound" /> <remove statusCode="500" /> <error statusCode="500" responseMode="ExecuteURL" path="/Error" /> </httpErrors> </system.webServer>
Controller public class ErrorController : Controller { // // GET: /Error/ public ActionResult Index() { Response.StatusCode = 500; return View("Error"); } public ActionResult PageNotFound() { Response.StatusCode = 404; return View(); } }
Что я уже пробовал:
Everything is going to fine here. But when i pass invalid parameter(localhost/home/index/55555) then it does't redirected to my custom page.(55555 is not a valid parameter here). Please can anyone help regarding this