110,532
社区成员
发帖
与我相关
我的任务
分享
[Authorize]
public class AdviserController : Controller
{
}
如果没登录 [Authorize]会让用户跳转到登录页
然后配置文件里
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" requestValidationMode="2.0" />
<authentication mode="Forms">
<forms loginUrl="/Account/Login" protection="All" name=".ASPXAUTH" timeout="20" />
</authentication>
</system.web>