Introduction
When a REST Web API is created to share data across multiple devices (e.g. mobile devices, desktop applications or any website), then the
authorization of REST Web API becomes a vital aspect in order to protect
data sensitivity from any outside breaches. I have recently created my
own small REST Web API Authorization library Asmak9.AuthorizeRESTWebApiAK which is compatible with any ASP.NET and .NET Console Application project.
Today, I shall be demonstrating the integration of Asmak9.AuthorizeRESTWebApiAK .NET library with ASP.NET REST Web API platform.

Prerequisites
The following are some prerequisites before you proceed any further in this tutorial:
- Install Asmak9.AuthorizeRESTWebApiAK NuGet Package.
- Knowledge of REST Web API.
- Knowledge of ASP.NET MVC5.
- Knowledge of C# Programming.
The example of code is
being developed in Microsoft Visual Studio 2019 Professional.
Let's begin now.
Step 1
Create a new Web API project and name it "RESTWebAuthorization".
Step 2
Open "Tools\Nuget Package Manage\Manage Nuget Packages for Solution...".
Step 3
Install Asmak9.AuthorizeRESTWebApiAK NuGet Package i.e.

Step 4
Open "Global.asax.cs" file and add following lines of code i.e.
- RESTWebAPIAuthHeaderHandler obj = new RESTWebAPIAuthHeaderHandler(ApiInfo.API_KEY_HEADER, ApiInfo.API_KEY_VALUE, ApiInfo.USERNAME_VALUE, ApiInfo.PASSWORD_VALUE);
- // API authorization registration.
- GlobalConfiguration.Configuration.MessageHandlers.Add(obj);





Jaimin ShethiyaPosted Dec 2, 2019, 10:23 PM
Nice article. :)
Sourav Kumar DasPosted Dec 2, 2019, 1:16 AM
Nice informative and useful article mam.