API Should not Externally Accessed from Postman / Browser Asp.Net Core | API Should be accessed from JQuery Ajax of Same Website Only Asp.Net Core 3 or Above
At Controller Validate Using ; [ApiAuthorize(new string[] { "https://localhost:7161/", "http://xyz.com" })] public class FarmerRegLoginController : Controller { ----------------------- ----------------------- ----------------------- ----------------------- Some Controller APIS Code ----------------------- ----------------------- ----------------------- ----------------------- } Create New Filter public class ApiAuthorizeAttribute : TypeFilterAttribute { public ApiAuthorizeAttribute(string[] origins) : base(typeof(ApiAuthorizeFilter)) { Arguments = new object[] { origins }; } } public class ApiAuthorizeFilter : IAuthorizationFilter { readonly string[] _origins; public ApiAuthorizeFilter(string[] origins) ...