0

I'm working on a ASP.NET MVC intranet site that uses windows authentication. My web.config is set up with:

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

Access to some parts of the site is also restricted using roles.

My main account is given the site administrator role, meaning that I have access to everything. This is fine for normal testing, but there are certain parts of the site that have more complex restrictions (e.g. user has role administrator or (user has role X and user is assigned to a group Y in the database)).

I've tried running site through Visual Studio, then opening another web browser as a different user, and when I access the site it pops up a windows authentication box but it won't accept any other logins - only when I enter my main account will it allow access. Roles don't have any affect on this, even when I add my second account as a site administrator it's denied access using this method.

^^If you think this is a duplicate of Testing intranet site that uses Windows authentication you didn't read the previous paragraph.^^

What am I doing wrong here? Is there some other method to test using multiple users?

Community
  • 1
  • 1
Merad
  • 749
  • 1
  • 6
  • 14
  • What's the other web browser, Chrome? And, what browser do you use when running the site through Visual Studio? – ataravati Dec 10 '15 at 16:52
  • 1
    Possible duplicate of [Testing intranet site that uses Windows authentication](http://stackoverflow.com/questions/6828699/testing-intranet-site-that-uses-windows-authentication) – Brad Christie Dec 10 '15 at 16:55
  • @ataravati IE11 for both – Merad Dec 10 '15 at 17:44
  • @BradChristie Prompting for the login is not the problem. The problem is logins that should be accepted are not (I suspect because they are different from the logged in windows account) – Merad Dec 10 '15 at 17:46
  • @Merad, are they not authenticated at all or they're authenticated after the prompt? – ataravati Dec 10 '15 at 20:20

2 Answers2

0

Create a Virtual PC and attach it to your network, then log in as various users and test your site on there. I had the same issue and this did the trick.

Virtual PC download here - https://www.microsoft.com/en-us/download/details.aspx?id=3702

haakon.io
  • 477
  • 6
  • 19
0

I eventually stumbled on the answer to this. The second user account that you want to test with needs to be given permissions to read the directories where the Visual Studio project is stored. Once that's done, running another browser instance with a different account works fine.

Merad
  • 749
  • 1
  • 6
  • 14