Solved

ASP.net MVC 4.0 good error message

Posted on 2014-01-19
1
174 Views
Last Modified: 2014-11-29
I want to display  nice message in ASP.net MVC 4.0 app if the URL entered by user does not match the registered routes.

Please advise the best method?
0
Comment
Question by:Jugnoo2013
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
ID: 39791992
Hi,

You have to handle 404 page not found error simply.

just add following entry in web.config and add the required error page:

<customErrors mode="On" defaultRedirect="/system/problem">
    <error statusCode="404" redirect="/system/notfound" />
</customErrors>


you may found following helpful:

http://stackoverflow.com/questions/903537/handle-invalid-url-in-mvc
http://stackoverflow.com/questions/5701922/correct-404-message-for-a-missing-asp-net-mvc-controller
http://stackoverflow.com/questions/8187109/asp-net-mvc-properly-handling-invalid-urls

Thanks
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question