我在web.config上设置了以下表单身份验证属性。
<authentication mode="Forms" >
<forms loginUrl="~/Account/VerifyCode" timeout="2880">
<credentials passwordFormat="Clear">
<user name="admin" password="admin"/>
</credentials>
</forms>
</authentication>
但总是在导航到使用[Authorize]属性修饰的控制器时,我总是被重定向到〜/ Account / Login?ReturnUrl =%2FProduct%2FCreate,而不是我在web.config中设置的方法(表示VerifyCode)。
任何人都知道为什么会这样,以及如何将其重定向到我在web.config中指定的方法?
尝试使用以下代码代替代码
<authentication mode="Forms">
<forms loginUrl="~/Account/VerifyCode" timeout="2880"/>
</authentication>