TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to Show your Custom Exception from Action in MVC
Mukesh Kumar
Nov 26
2015
Code
822
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Step 1:
public
class
HomeController : Controller
{
[HandleError()]
public
ActionResult Index()
{
throw
new
Exception(
"my exception"
);
}
}
Step 2:
<
system.web
>
<
customErrors
defaultRedirect
=
"Error.cshtml"
mode
=
"On"
>
</
customErrors
>
</
system.web
>
MVC
exception