Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.net MVC 4.0 good error message

Posted on 2014-01-19
1
Medium Priority
?
184 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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:…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

618 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