Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC and mixed mode authentication

I have a scenario whereby I require users to be able to authenticate against an ASP.NET MVC web application using either Windows authentication or Forms authentication. If the user is on the internal network they will use Windows authentication and if they are connecting externally they will use Forms authentication. I’ve seen quite a few people asking the question how do I configure an ASP.NET MVC web application for this, but I haven’t found a complete explanation.

Please can someone provide a detailed explanation, with code examples, on how this would be done?

Thanks.

Alan T

like image 426
Alan T Avatar asked Mar 12 '10 13:03

Alan T


People also ask

What type of authentication is used in MVC?

The Authentication is performed by IIS in one of three ways such as basic, digest, or Integrated Windows Authentication. When IIS authentication is completed, then ASP.NET uses the authenticated identity to authorize access.

How does authentication work in MVC?

ASP.NET MVC Authentication is a feature in MVC that helps in making the website highly secure and safe. Authentication is the process of confirming or validating the user's identity if the user who is trying to access the web page or web application is a genuine user or not.

What is the difference between authentication and authorization in MVC?

Authentication is done before the authorization process, whereas the authorization process is done after the authentication process. In the authentication process, the identity of users are checked for providing the access to the system.


1 Answers

This is called mixed authentication mode. Basically you cannot achieve this within a single application because in IIS once you set up Windows authentication for a virtual directory it will no longer accept users from different domains. So basically you need to have two applications, the first with Windows Authentication and the second (the main application) using Forms authentication. The first application will consist of a single address which will simply redirect to the main application by issuing an authentication ticket for the domain user.

like image 141
Darin Dimitrov Avatar answered Oct 14 '22 20:10

Darin Dimitrov