Redirecting to a custom Windows Authentication login page if the user is anonymous in ASP.NET MVC

I have an ASP.NET MVC intranet site using Windows Authentication. It is configured from the default project for ASP.NET MVC using Windows Authentication. I am trying to find information on overriding the login popup by default if the user is not authenticated / anonymous.

The default login request is:

Default Windows Auth Login Prompt

Everything I find on the Internet is almost 10 years old using classic ASP or Web Forms. Nothing I can find is using ASP.NET MVC.

I would like the user to be redirected to the login view if he is anonymous / not authenticated. In addition, the ability to exit the system if they are automatically authenticated and registered as another user.

The main problem is that I cannot find where the actual authentication is performed in my project. I checked App_Start, Global.asaxetc. I can not find how to redefine it.

I know that for my part there is a lack of code, but I would appreciate it if someone had a good starting point or experience with this requirement.

+4
source share
2 answers

... IIS Windows. :

  • Windows TCP/IP, ( , ). , Windows, ( Kerberos NTLM).
  • Windows
  • - IIS ( Windows ).

. , :

  • , , , /
  • , , , ADFS.
+2

. , / Windows.

MVC, . AD . cookie

FormsAuthentication.SetAuthCookie(model.UserId, true);

. [Authorize].

+1

Source: https://habr.com/ru/post/1680896/


All Articles