Handling Exceptions in Asp net Mvc using base co...
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.
Log File Example Created By Base Controller.You can have a look at video tutorial on you tube.
Blackjack Table Games | Mr. McD
ReplyDeleteThis is the best table game, you 당진 출장안마 get to play your favorite blackjack. It 청주 출장마사지 is played for a 경주 출장마사지 range of game styles 포천 출장안마 and there is never a 진주 출장안마 dull moment.