Solved

ASP.net MVC 4.0 good error message

Posted on 2014-01-19
1
157 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
1 Comment
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
GridDataView 6 44
Is IHttpActionResult a promise pattern? 2 32
Wpf develop 5 30
Redacting a row in Excel based on a term. 17 31
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now