I am developing a web application with MVC-3
I want to give the users of a particular windows domain some special privileges; therefore I have to determine whether the request is coming from that particular domain.
Please note that I am using Forms authentication.
I know that I can do this by tracking the IP address of the user. But is there a way to directly get the domain name?
For example, if the user is logged in as ADomain\AUsername
in a windows machine, is there a way to get ADomain
?
The answer is, maybe and sometimes. First, only Internet Explorer passes credentials through to the server. Second, the server must be on the same domain as the client, third there can't be any proxies or other things in between. Both computer and client must be on the same network as well.
Even with all that, it still only works sometimes. What version of IIS? If it's IIS7 or greater, then there are other issues where you can't combine forms authentication and windows authentication. If you're using IIS6, then it might be able to be done, but it's a huge pain.
In practice, I wouldn't bother.. it's just too much effort for saving the users from typing in their username and password.