Handling Errors with ASP.NET MVC
page 2 of 5
by Steven Smith
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 43893/ 75

In the beginning…

When you first create your ASP.NET MVC 3 application, it won't include any error handling information at all, aside from a very simple shared view called Error.cshtml (assuming you're using the Razor view engine).  That page is static and simply tells the user, "Sorry, an error occurred while processing your request."  If you create a new controller action and throw an exception (see Listing 1), and then hit that controller action in your browser, you may be surprised to see that the error view is not rendered.

Listing 1 - Throwing an Exception in an Action

        public ActionResult CreateErrorOne()
            throw new Exception("No attributes.");

The result is a Yellow Screen of Death (YSOD):

View Entire Article

User Comments

Title: exception   
Name: how to remove an exception
Date: 2011-03-28 6:59:43 AM
am getting an exception Function or proceedure xyz has too many arguments..

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2020 ASPAlliance.com  |  Page Processed at 2020-05-27 5:22:23 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search