Sso login in asp net mvc web application can not open microsoft page for login


ASP.NET is a popular programming language used for building web applications. One requirement in web applications is to implement Single Sign-On (SSO) functionality, which allows users to log in once and access multiple applications without having to provide their credentials again. In this article, we will explore how to implement SSO login in an ASP.NET MVC web application and troubleshoot the issue of not able to open the Microsoft page for login.

Implementing SSO Login in ASP.NET MVC

To implement SSO login in an ASP.NET MVC web application, we can leverage the built-in authentication and authorization features provided by ASP.NET. One popular is to use the OpenID Connect protocol, which is an of OAuth 2.0.

, we need to configure our ASP.NET MVC application to use OpenID Connect for authentication. This can be done by adding the necessary NuGet and modifying the application's startup code. Here's an example of how the startup code might look:

public void ConfigureServices(IServiceCollection services)
    // Add authentication services
    services.AddAuthentication(options =>
        options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
    .AddOpenIdConnect(options =>
        options.Authority = "{tenant-id}/v2.0";
        options.ClientId = "{client-id}";
        options.ClientSecret = "{client-secret}";
        options.CallbackPath = "/signin-oidc";
        options.ResponseType = "code";
        options.SaveTokens = true;

    // Other service configurations

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    // Other app configurations

    // Use authentication middleware

    // Other middleware configurations

In the above code, we configure the authentication to use cookies as the default authentication scheme and OpenID Connect as the default challenge scheme. We specify the authority URL, client ID, client secret, callback path, response type, and whether to save tokens.

Troubleshooting the Issue

If you are facing an issue where the Microsoft page for login is not opening, there could be several reasons for this. Let's explore some possible and their solutions:

1. Incorrect Client ID or Client Secret

Ensure that you have provided the correct client ID and client secret in the OpenID Connect configuration. These values are obtained when you register your application with the Microsoft identity platform. Double-check the values and make sure they match.

2. Invalid Callback Path

The callback path specified in the OpenID Connect configuration should match the actual route in your ASP.NET MVC application. If the callback path is incorrect, the Microsoft page for login may not be able to redirect back to your application after authentication. Verify that the callback path is correct and update it if necessary.

3. Missing Redirect URI in Application Registration

When registering your application with the Microsoft identity platform, you need to specify the redirect URI. This is the URL where the user will be redirected after authentication. Ensure that you have added the correct redirect URI in the application registration settings. If the redirect URI is missing or incorrect, the Microsoft page for login may not be able to redirect back to your application.

4. Network Connectivity

If you are unable to open the Microsoft page for login, it could be due to network connectivity issues. Check your internet connection and ensure that there are no firewall or proxy restrictions preventing access to the login page. You can also try accessing the page from a different network or device to rule out any local network issues.


In this article, we discussed how to implement SSO login in an ASP.NET MVC web application using OpenID Connect. We also explored some possible causes and solutions for the issue of not being able to open the Microsoft page for login. By following the steps outlined and troubleshooting the potential causes, you should be able to successfully implement SSO login in your ASP.NET MVC web application.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents