MVC Windows身份验证 [英] MVC Windows Authentication

查看:132
本文介绍了MVC Windows身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MVC应用程序中实现Windows身份验证,但遇到了一些麻烦.

i'm trying to implement windows authentication in a MVC application but I'm having some trouble.

我已经创建了一个名为"test"的新用户,并向他授予了IIS中该文件夹的所有权限

I had create a new user called "test" and i gave him all the permissions to the folder in IIS

在网络配置中,我编写了以下代码:

In the web config i wrote this code:

 <system.web>
     <authentication mode="Windows"/>
     <authorization>
        <deny users="?"/>
     </authorization>
...

我将在产品控制器上授权的属性设置如下

I i set the attribute authorized on the products controller as follows

[Authorize(Users="test")]
    public class ProductsController : Controller
    { ...

我也只能尝试

[Authorize]
    public class ProductsController : Controller
    {...

当我尝试输入密码时,即使用户名和密码正确,它也会不断询问我没有授予我输入权限的权限

When I try to enter it asks me constantly credentials without give me permission to enter even if username and password are correct

我在哪里做错了?

推荐答案

一次尝试这两种解决方案,看看哪种解决方案可以解决.

Try these two solutions one at a time and see which one fixes it.

1)在IIS中配置Windows身份验证.

2)遵循

2) Follow this guide till step 3. Set it to NTLM and attempt to access the site. If not switch to Negotiate.

如果Windows身份验证有奇怪的问题,这些通常是我需要执行的步骤.

These are usually the steps I need to perform if I have odd issues with windows authentication.

这篇关于MVC Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆