protected override async Task ApplyResponseChallenge() { if (Response.StatusCode != 401 || string.IsNullOrEmpty(Options.LoginPath)) { return; } var challenge = Helper.LookupChallenge(Options.AuthenticationType, Options.AuthenticationMode); if (challenge != null) { string baseUri = Request.Scheme + "://" + Request.Host + Request.PathBase; string currentUri = WebUtils.AddQueryString( baseUri + Request.Path, Request.QueryString); string loginUri = WebUtils.AddQueryString( baseUri + Options.LoginPath, Options.ReturnUrlParameter ?? Constants.DefaultReturnUrlParameter, currentUri); Response.Redirect(loginUri); } }