Skip to main content


Why To Use HttpClientFactory In .Net Core

HttpClient instance was used to invoke or consume the external rest API by clients like console applications or web applications. What Is Socket?: A Socket is a system communication protocol providing a communication channel over TCP connection. In programming, terminology socket can be defined as the combination of Url and Port Number to make communication channels. HttpClient Working Flow: Let's assume that we have .Net Core application, which will consume an external API using HttpClient. The steps involved in communication are as follows: The user requests our application, in which we need to call an external API to serve results to the user. On receiving user request our application creates an instance of HttpClient. Next HttpClient looks for HttpRequestHandler object in the pool of HttpRequestHandlers. Then HttpClient picks up one of the HttpRequestHandler objects and gives all input information like Url, payload, tokens, etc to make an external API call. Then HttpRequest

An Overview On Ionic Action Sheet In Angular(ion-action-sheet)

Ionic Action Sheet is a dialog that contains a collection of actionable buttons that display over the application. Here we are going to understand Ionic Action Sheet implementation in Angular. ActionSheetController And ActionSheetOptions: The main building blogs for developing Ionic Action Sheet can be like ActionSheetController ActionSheetOptions ActionSheetController is imported from the package '@ionic/angular'. ActionSheetController is injectable controller into our any of the ionic angular component through constructor injection. An ActinSheetController can create an n-number of action sheets within the components. ActionSheetController bundled with three main methods like create dismiss getTop create  method helps to instantiate or build the Ionic Action Sheet by taking ActionSheetOptions as input configuration. Ionic Angular create(action sheet create method) syntax: create(opts?: Opts): Promise<Overlay>; dismiss method helps to destroy the action sheet, it ta

Refresh Token For JWT(JSON Web Token) On Authenticating .Net Core Application

In  Part-1 .Net Core Authentication Using JWT(JSON Web Token) , we have discussed step by step implementation about generating authentication token using JWT(JSON Web Token). Now we will discuss the generation of refresh token and using refresh token we will fetch authentication token again on its expiration. This article will be the continuation of  Part - 1 . RandomNumberGenerator Instance: System.Security.Cryptography.RandomNumberGenerator will be used to generate a random number which will be used as a refresh token. Note: It is not a mandatory approach to use 'System.Security.Cryptography.RandomNumberGenerator'. You can use your own some secured technique to generate a unique token string or you can use GUID. Generate Refresh Token: Let's add a private method that returns a random unique key that we can use as a refresh token. Logic/AccountLogic.cs: private string GetRefreshToken() { var key = new Byte[32]; using (var refreshTokenGenerator = RandomNumberGenerator.C

.Net Core Authentication Using JWT(JSON Web Token)

.Net Core application has many different authentication techniques like Cookie Authentication, Microsoft Identity Library, Identity Server 4, JWT, OAuth, etc. For a single page application that uses .Net Core Web Rest API, JWT is one of the simple and best approaches for performing token-based authentication. Here we going to understand the integration of JWT authentication for .Net Core API with a sample implementation. Overview On JWT: JSON Web Token is a digitally signed and secured token for user validation. JWT is constructed with 3 informative parts like: Header Payload Signature Create A Sample .Net Core API: Let's create a sample .Net Core API application to implement the JWT authentication. You can use an editor like Visual Studio 2019(Supports .Net Core 3.0 plus) or  Visual Studio Code . Add User.cs File: Let's add a User.cs file that represents a model of the user table(table will be integrated later steps). Data/Entities/User.cs: namespace JwtApiSample.Data.Enti

Configuration And Working Mechanism Of JSON Files On .Net Core Application Starts

.Net Core application JSON file configuration technique has come into picture by replacing traditional way like Web.Config file approach. By default application loads "appSettings.json" file on startup. If we have defined environment variable then application also loads environmental specific json files like "appSettings.Development.json"(for environment variable is Development), "appSettings.Stage.json"(for environment variable is Stage), "appSettings.Production.json"(for environment variable is Production) along with the "appSetting.json". Create A Sample .Net Core Application: Now for better understanding let's walk through with a sample .Net Core Web API application. The application can be created either by using Visual Studio 2019(VS Editor supports .Net Core Version 3.0plus) or  visual Studio Code App Loads appSettings.json And appSettings.{Environmental_Variable}.json By Default: On application start, appSettings.json and ap