MVC Windows Authentication

本小妞迷上赌 提交于 2020-01-16 06:10:29

问题


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

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
    { ...

i also try only

[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

Where I am doing wrong?


回答1:


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

1) Configure windows authentication in IIS.

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

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



来源:https://stackoverflow.com/questions/29196004/mvc-windows-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!