In the asp.net core application, I want to write Authorization middleware on my own . I am trying to implement it similar to Example 2.
But if I try to use I get compilation error saying "IApplicationbuilder doesnt contain a definition of UseAuthorization"
How to add my custom method to IApplicationBuilder?In which file I need to add my method?.
Startup.cs
public void Configure(IApplicationBuilder app,IHostingenvironment env)
{
app.UseAuthorization();
}
Example 2:
public static IApplicationBuilder UseAuthorization(this IApplicationBuilder app)
{
return app.UseMiddleware<AuthorizationMiddleware>();
}
question from:
https://stackoverflow.com/questions/66048031/overriding-useauthorization-behaviour-in-net-core 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…