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
가 UriHelper 구현 /
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);
});