我在我的 MVC3 Web 应用程序中使用表单身份验证。我在 root web.config 中添加了以下内容:
<authentication mode="Forms">
<forms name=".FormsAuth" loginUrl="~/Home/Index" timeout="2880" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
当我启动我的应用程序时,它会重定向http://localhost:22888/Home/Index?ReturnUrl=%2f到http://localhost:22888. 如果我删除线路<deny users="?">,那么它会正确重定向,但Context.User.Identity.Name登录后没有给出任何值。
请帮忙。