0
什么时候使用Map和MapWhen在我们正在验证请求的时候在asp.net核心中间件中分支。Map和MapWhen在asp.net核心中间件中的区别?
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Map("", (appBuilder) =>
{
appBuilder.Run(async (context) => {
await context.Response.WriteAsync("");
});
});
app.MapWhen(context => context.Request.Query.ContainsKey(""), (appBuilder) =>
{
appBuilder.Run(async (context) =>
{
await context.Response.WriteAsync("");
});
});
}