You can create middleware in which you can automatically resolve requests coming from the local host.
public class MyAuthorize { private readonly RequestDelegate _next; public MyAuthorize(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext httpContext) {
Then create an extension method
public static class CustomMiddleware { public static IApplicationBuilder UseMyAuthorize(this IApplicationBuilder builder) { return builder.UseMiddleware<MyAuthorize>(); } }
and finally add it to the Configure
launch method.
app.UseMyAuthorize();
Asp.Net Core did not have the IsLoopback
property. Here is the work for this fooobar.com/questions/556399 / ...
You can also read here Middleware here
Ahmar source share