Mauro Cudicio
Mauro Cudicio

Reputation: 85

MVC Windows Authentication

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?

Upvotes: 1

Views: 240

Answers (1)

Judge Bread
Judge Bread

Reputation: 501

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.

Upvotes: 1

Related Questions