C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Show your Custom Exception from Action in MVC
WhatsApp
Mukesh Kumar
Nov 26
2015
876
0
0
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
Up Next
How to Show your Custom Exception from Action in MVC