Hello,
I'm newbie to MVC, trying to create a custom error page and show when user is looking for resource which isn't available. Followed few articles and able to show an custom error page.
- https://stackoverflow.com/questions/717628/asp-net-mvc-404-error-handling?answertab=votes#tab-top
I have created an Error Controller with 'NotFound404()' action method and view is created with the same name 'NotFound404.cshtml'.
- public class ErrorController : Controller
- {
- // GET: Error
- public ActionResult NotFound404()
- {
- return View();
- }
- }
- <system.web>
- <customErrors mode="On">
- <error statusCode="404" redirect="~/Error/NotFound404"/>
- customErrors>
- system.web>
Why do i get such wierd url? and i'm not using any aspx pages but it shows aspx in url. HTTP status under F12-Developer tools- Network - shows 200 OK. which isn't correct. How to rectify this.
And when i tried to access any static html page instead of a new controller/ action-view
- <system.web>
- <customErrors mode="On">
- <error statusCode="404" redirect="~/Shared/NotFound.html"/>
- customErrors>
- system.web>
is this error because of looking up for wrong path.?
My application folder structure

How to fix these errors and please show a right way to configure these error handling strategies.
Thanks in advance.
Bhavesh JadavPosted Mar 27, 2018, 11:46 PM
Manav PandyaPosted Mar 27, 2018, 12:03 PM
L APosted Mar 27, 2018, 11:53 AM
Manav PandyaPosted Mar 27, 2018, 1:51 AM
Hiten PandyaPosted Mar 26, 2018, 11:34 PM
Please refer the below link. It has something that will be helpful for you.
http://benfoster.io/blog/aspnet-mvc-custom-error-pages
Hope you get your answer.
Thanks.