How to Remove “Use Another Service to Log In” Message in ASP.NET Core App
When developing an ASP.NET Core application, you may encounter a situation where the “Use Another Service to Log In” message appears on the login page. This message is displayed when the application supports multiple external authentication providers, such as Google, Facebook, or Twitter. However, in some cases, you may want to remove this message and only allow users to log in using the application's own authentication system. In this article, we will explore how to achieve this in ASP.NET Core.
Step 1: Locate the ExternalLogins partial view
The “Use Another Service to Log In” message is typically displayed in the ExternalLogins partial view, which is responsible for rendering the external authentication provider buttons. To remove this message, we need to modify this partial view.
Locate the ExternalLogins partial view in your ASP.NET Core project. It is usually located in the “Views/Account” folder. Open the file and find the section where the message is displayed.
Step 2: Remove the message code
To remove the “Use Another Service to Log In” message, simply delete the code block that displays it. After removing the code, the partial view should look like this:
@* Remove the code block that displays the message *@
Step 3: Update the login view
After removing the message from the ExternalLogins partial view, we need to update the login view to reflect this change. Open the Login.cshtml file located in the “Views/Account” folder.
Find the section where the ExternalLogins partial view is rendered. It should look like this:
Use another service to log in.
@await Html.PartialAsync("_ExternalLoginsList", new ExternalLoginsViewModel { ReturnUrl = Model.ReturnUrl })
Remove the entire section that renders the ExternalLogins partial view. After removing this code, the login view should look like this:
Step 4: Test the application
Save the changes and run your ASP.NET Core application. The “Use Another Service to Log In” message should no longer appear on the login page. Users will only be able to log in using the application's own authentication system.
By following these steps, you can easily remove the “Use Another Service to Log In” message in your ASP.NET Core application. This customization allows you to provide a more streamlined and focused login experience for your users.