更新时间:2023-02-25 20:36:31
中间件!
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
{
app.Use(next => async context =>
{
context.Response.Headers.Remove("Server");
await next.Invoke(context);
});
app.Use(next => async context => {
if (context.Request.Path.ToString().StartsWith("www"))
await next.Invoke(context);
else
context.Response.Redirect("www" + context.Request.Path.ToString());
});
}
这是一个很好的教程.