0

There are two domains (A and B). The two domains are in trusted relationship. There is an IIS web server in the A domain.

In Visual Studio, I created an MVC project and it is configured in Controller for Windows authentication. I read the data like this:

  • u = System.Web.HttpContext.Current.User.Identity.Name.ToLower ();

The user in A domain is called Alex. The user in the B is Ben.

If Alex opens the page from his machine (computer is in the A domain), then everything works nicely.

  • Automatically comes A\Alex

If Ben opens the page from his computer (computer is in B domain), then:

  • By default, it comes the authentication windows! But if I give this data, everything works fine.

    • A\Alex + password: OK
    • B\Ben + password: OK
  • I even tried:

    • Alex + password: OK
    • Ben + password: It was not good (but the webserver is in the A domain, so that is no problem)
  • And if I add the page in IE/Security to "Local Intranet" then:

    • Automatically comes to B\Ben

So far, everything is fine and works accordingly. I can't find the solution for the next (and have tried a lot of things...)

If we use an independent machine from a third domain or even a mobile phone, then:

  • Request Authentication:

    • A\Alex + password: OK
    • Alex + password: OK (Up this point is everything as I expected!)
    • B\Ben + password: NOT OK (WHY?!?!?)

Any idea what might be the problem? Thank you in advance for your help!

EDIT: In the controller is:

[Authorize]
public class HomeController : Controller
 {

web.config:

<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<authentication mode="Windows" />
<authorization>
<allow users="*" />
<deny users="?" />
</authorization>
<identity impersonate="true" />
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" />
<customErrors mode="Off" />
</system.web>
Grusalak
  • 1
  • 2
  • What do you mean by "it is configured in Controller for Windows authentication"? BTW, it is bad idea to call `System.Web.HttpContext.Current.User`. Always use `Controller.User`. – Lex Li Dec 14 '18 at 14:13
  • Controller is: [Authorize] public class HomeController : Controller { ... And web.config is: – Grusalak Dec 15 '18 at 10:32
  • Please edit your question to include new info, and well format them so others can review it. Don't use comments for that. – Lex Li Dec 15 '18 at 14:22

0 Answers0