HttpContext.Response.Redirect("~/Shared/views/Error.cshtml", true);
This is not working for me
And how to exclude the certain controllers and actions
HttpContext.Response.Redirect("~/Shared/views/Error.cshtml", true);
This is not working for me
And how to exclude the certain controllers and actions
Copyright © 2021 Jogjafile Inc.
As you can see in documentation, method which you are trying to use require to arguments
and first argument is an
url
of page where user should be redirected, while you are passing view file path. In asp. mvc path to *cshtml file is not equal to url.I suggest you to use
RedirectToRoute
method insteadwhere your desired view is returned by
ErrorController.Index()
action.