2

我有一个使用 Windows 身份验证的 .NET MVC 4 应用程序。我想检查用户是否是特定 Active Directory 组的成员,如果是,则显示一个附加菜单选项:

            if(User.IsInRole("WellnessAdmins"))
            {
                <li>
                    <b>@Html.ActionLink("Admin","Admin","Home")</b>
                </li>
            }

当部署到服务器时,这工作正常;显示管理员链接。但是,当我从 Visual Studio 启动应用程序时,不会显示 Admin 链接。我的本地计算机和服务器在同一个域上。为什么会有这种奇怪的行为?

4

1 回答 1

2

If you are using IIS Express make sure that you have enabled Windows Authentication and disabled Anonymous Authentication in the properties of your project:

enter image description here

于 2013-08-26T15:10:37.797 回答