Solved

ASP.net MVC 4.0 good error message

Posted on 2014-01-19
1
177 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

689 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