Posts

Working with React.js Class Components

Image
React.js is a first class JavaScript library for building front-end for the modern web applications. This library is based on a WebComponent concept. The WebComponent is an autonomous object which has it own UI, Data and logic (presenter). The React.js is makes use of this concept to implement <b>Compositional UI<b>.In React.js, we can create components using 2 mechanisms, the first is Class Component and the second is Functional Components.     Class Components, are the pure implementation of ES 6 class concept. The class component is derived from Component base class. This base class contains render() method to render the HTML UI. The class components defines local public properties. These properties represents State of the class component. The State, means the data that will be used by class component to manipulate local to component so that the the HTML UI can be rendered. Functional Components, are the JavaScript functions. These functions returns the HTML so that the…

Using TempData and Creating Custom Exception Filter in ASP.NET Core 3.1

Image
The exception handling in Web application is the most important part. Exception Handling must be implemented so that if the the HTTP request processing is failed on the server and exception occurred then the error page with required error must be shown to the user.   
Filters in ASP.NET Core
In ASP.NET Core, Filters allows code to before or after specific stages in the request pipeline are executed e.g. OnActionExecuting and OnActionExecuted().  We have standard filters like Authorization and ResponseCaching. We can add custom filters in the request pipeline for additional operations e.g. Exception Handling, Custom Authorization, etc. The following figure will explain  filter execution in ASP.NET Core 3,1 application 


Figure 1: The Filter Execution

As shown in the above figure, filters are executed in MVC application pipeline. This means that when MVC controllers are requested the filters will be loaded in the pipeline and they are executed as per the configuration. For example, the e…