2
Это правильный способ постоянной переадресации, когда путь не указан для запроса?Первичное перенаправление основного ядра ASP.NET, если указанный путь не указан
app.Use(next => context =>
{
if (string.IsNullOrWhiteSpace(context.Request.Path))
{
var builder = new UriBuilder(context.Request.Scheme, "site to redirect");
context.Response.Redirect(builder.ToString(), true);
}
return next(context);
});
Обновление 1
По-видимому, включает в себя context.Request.Path
/
app.Use(next => context =>
{
if (context.Request.Path.Value.Length <= 1)
{
var builder = new UriBuilder(context.Request.Scheme, "www.plaMobi.com");
context.Response.Redirect(builder.ToString(), true);
}
return next(context);
});