ServiceStack AuthFeature.HtmlRedirect被忽略

Big*_*toe 1 authentication servicestack

当我设置身份验证功能重定向属性时,我在访问安全页面时没有应用它.例如,我将身份验证功能设置为重定向以使用页面中的自定义登录.

authFeature.HtmlRedirect = "http://localhost/SimpleService/login";
Run Code Online (Sandbox Code Playgroud)

但是,如果我转到安全控制器,这个重定向永远不会被应用,它总是使用服务堆栈默认的"/ login".它正在使用的重定向甚至不包括SimpleService的原始站点名称.以下样品控制器.

[Authenticate]
public class PrivateController : ControllerBase
{
    public ViewResult SecurePage()
    {
        return View();
    }
}
Run Code Online (Sandbox Code Playgroud)

我也试图覆盖Authenticate属性上的重定向,但无济于事.有没有人有任何想法我可能做错了什么?

[Authenticate(HtmlRedirect = "http://localhost/SimpleService/login")]
public class PrivateController : ControllerBase
{
    public ViewResult SecurePage()
    {
        return View();
    }
}
Run Code Online (Sandbox Code Playgroud)

use*_*621 7

我遇到了与上述相同的问题.我找到的解决方法是覆盖基本控制器中的LoginRedirectUrl.这对我有用.

例如

public override string LoginRedirectUrl
{
    get
    {
        return "/Account/Login?redirect={0}";
    }
}
Run Code Online (Sandbox Code Playgroud)