Exception Handling and Creating Exception Logs in Asp.net MVC | Code2night.com
Code2night
  • Home
  • Blogs
  • Guest Posts
  • Tutorial
  • Post Blog
  • Register
  • Login
  1. Home
  2. Blogpost

Exception Handling and Creating Exception Logs in Asp.net MVC

Date- Aug 05,2020

15330

Aspnet

Exception Handling and Creating Exception Logs in Asp.net Mvc  :-

As per a Developer we have to face issue of handling Exception Effectively.In this Article we will see how to handle exceptions effectively in Asp.Net MVC.So Let's See how it works:-

Base Controller:- 

So basically in a MVC Project  we often use many controllers for making our web project functional.So one way is to handle exception separately on all of them or we can simple use a Base Controller. A Base controller can be told as a parent controller from which all other controller will inherit.So in that way Exception handling performed on Base Controller will get applied on all controllers which inherits from  this controller.


So you can see a Base Controller which has OnException Method to handle all the exceptions

This Error Log Method is used to add Logs to your Log File so that you can check your exceptions for debugging in a better way.

Inherit Controller from Base Controller:-
So after we have successfully set up OnException Action Method and Error Log File Now we can inhrit controllers from this Base Controller.


So this is how you can use your base controller with all controllers simply by inheriting.Now whenever any exception will occur on you Blog Controller or your controller it will Log its Details in Log Files.


Comments

Tags

LinkedinLogin
LinkedinProfile
GetLinkedinProfile
C#
Aspnet
MVC
Linkedin
ITextSharp
Export to Pdf
AspNet Core
AspNet
View to Pdf in Aspnet
Model Validation In ASPNET Core MVC 60
Model Validation
Model Validation In ASPNET Core MVC
Model Validation In ASPNET
Image Compression in AspNet
Compress Image in c#
AspNet MVC
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1190
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Panipat
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2025 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Terms & Conditions
  • Refund Policy
  • About Us
  • Privacy Policy
  • Json Beautifier
  • Guest Posts