question

AltaliaNarrantes-2547 avatar image
1 Vote"
AltaliaNarrantes-2547 asked AltaliaNarrantes-2547 edited

User login in asp.net MVC using windows authentication without prompt

We want to host ASP.NET MVC 5 project (.NET 4.8 Framework) where users will be automatically authenticated via their Windows login. When the users call the hosted project via the browser, then the browser should not prompt the user to login. The browser should pass the login-data to the server-side controller automatically.

Regarding this article, the Integrated Windows Authentication uses the security features of Windows clients and servers. Unlike Basic or Digest authentication, initially, it does not prompt users for a user name and password.

So the Integrated Windows Authentication seem to be the correct solution for our problem.

The MVC 5 Project has the following entry in the web.config file: Here are the authenciation settings in IIS:

104145-ygadj.png

The Problem: When we access the site in the browser via the binding http://192.168.178.41 then we expect, that the user is logged in automatically, but an prompt appears:

104070-xkqh1.png

How to login in asp.net MVC using windows authentication without prompt?


windows-serverdotnet-aspnet-core-mvcdotnet-aspnet-general
ygadj.png (24.3 KiB)
xkqh1.png (7.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AgaveJoe avatar image
0 Votes"
AgaveJoe answered

Silent login works in browser that have Windows Authentication enabled and when the browser is on the same domain as the server. There can be other configuration issues as well.

https://forums.iis.net/t/1234764.aspx?Disable+asking+user+credentials+in+windows+authentication
https://stackoverflow.com/questions/5402381/receiving-login-prompt-using-integrated-windows-authentication


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered

Hi @AltaliaNarrantes-2547 ,
As far as I think,you need to make changes to your browser configuration.

1.Open Internet Explorer, select the Internet Options menu item and open the Security tab of the popup window.
1. Click the Local intranet icon and then click the Sites button and a new window will open.
2. Click the Advanced Button and a new window will open.
3. Enter the URL in the upper input box, click the Add button. Then enter a URL and click the Add button again. Then click the Close button and then click OK out of the
previous window.
4. Select the Security tab at the top then select Custom Level again. Scroll down to User Authentication and select Automatic logon with current user name and
password. When finished select OK.
5. Select the Advanced tab at the top then select the box Enable Integrated Windows Authentication* and click Apply.
6. Restart.

Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PatriceSc-5382 avatar image
0 Votes"
PatriceSc-5382 answered

Hi,

Windows authentication happens for intranet sites and using an IP address likely prevent to detect that.

If I remember it is considered part of the intranet zone if you don't have any dot in the name ie try to use using https://myserver rather than its IP.

It might work for https://myserver.company.net for example but I believe that even in this case your company must use a GPO to configure all PC in your compay to consider that *.company.net sites are part of the intranet zone.

prompt-for-username-and-password could alos perhaps help.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.