TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
L A
NA
170
171.5k
HTTP 404 : Resource Not found - Custom error
Mar 26 2018 1:35 PM
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();
}
}
Web.config
<
system.web
>
<
customErrors
mode
=
"On"
>
<
error
statusCode
=
"404"
redirect
=
"~/Error/NotFound404"
/>
customErrors
>
system.web
>
When i try to access any unknown resource, i can see the notfound404.cshtml. But when i inspect url it shows as 'http://localhost:xyzw/Error/NotFound404?aspxerrorpath=/New'.
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
>
404 Error occurs
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.
Reply
Answers (
5
)
Is any one had work on CloudMailin with Asp.net MVC
how to add template in my asp.net prject ?