从FormsAuthentication迁移到Identity时,我有一些代码具有:
return Redirect(FormsAuthentication.DefaultUrl);在Identity中,我找不到这个配置(我也不知道为什么它首先在FormsAuthentication上),我将更改为
return Redirect("~/");此场景是否有任何标识配置,或者只是从标识中删除了该功能?
发布于 2014-10-04 07:21:00
这在身份中是不存在的。
但是,当您进行身份配置时,您可以在Auth.Config.cs中执行如下操作
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
// other stuff
}看到LoginPath属性集了吗?这就是重定向地址,它现在的工作方式与FormsAuthentication.DefaultUrl相同,只是您没有在web.config中指定它。
https://stackoverflow.com/questions/26187399
复制相似问题