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("");
});
});
}