主机名中的连字符在重定向时丢失

Hyphen in the host name is getting lost on redirect

我使用 AuthenticationProperties 根据 ExpiresUtc 值使用户会话过期。会话超时正常,但 URL 在重定向发生时丢失了主机名上的连字符。

会话超时重定向发生时的当前页面来自:

例如: https://web-beta-test.chocolate.com/Searchhttps://webbetatest.chocolate.com/?ReturnUrl=%2FSearch

连字符丢失,因此服务器找不到该页面。 localhost 在重定向到登录页面时工作正常,因为不涉及连字符。

我要解决什么问题?请提示

 try
            {
                var principal = await CreatePrincipal(userTicket.LoginName, userTicket, null);
                var context = _accessor.HttpContext;
                await context.SignInAsync(principal, GetAuthProperties());
                context.User = principal;
                return true;
            }
private AuthenticationProperties GetAuthProperties()
        {

            var authProperties = new AuthenticationProperties
            {
                AllowRefresh = true,
                // Refreshing the authentication session should be allowed.

                ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(SessionTime),
                // The time at which the authentication ticket expires. A 
                // value set here overrides the ExpireTimeSpan option of 
                // CookieAuthenticationOptions set with AddCookie.

                IsPersistent = false,
                // Whether the authentication session is persisted across 
                // multiple requests. When used with cookies, controls
                // whether the cookie's lifetime is absolute (matching the
                // lifetime of the authentication ticket) or session-based.

                IssuedUtc = DateTime.Now
                // The time at which the authentication ticket was issued.

            };
var principal = await CreatePrincipal(userTicket.LoginName, userTicket, null);
 var context = _accessor.HttpContext;
 await context.SignInAsync(principal, GetAuthProperties()); context.User = principal;

对于遇到连字符丢失这种情况的任何人 - 身份验证没有任何问题 - 问题出在负载均衡器上。必须更正它以在重定向发生时允许使用连字符。