Asp net core site getting redirected to azurewebsites net

ASP.NET is a popular programming language used for developing web applications. It provides a powerful framework for building dynamic and websites. However, sometimes developers may encounter issues with ASP.NET Core site getting redirected to In this article, we will explore the possible causes of this issue and provide to resolve it.

One possible for the redirection is the misconfiguration of the application's routing settings. ASP.NET Core uses routing to determine how incoming requests should be handled. If the routing configuration is incorrect, it can result in redirections. To fix this issue, you need to ensure that the routing settings are properly configured.

Checking Routing Configuration

To check the routing configuration, open the Startup.cs file in your ASP.NET Core project. Look for the Configure method and that the routing middleware is properly configured. The following demonstrates a basic routing configuration:

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


    app.UseEndpoints(endpoints =>
            name: "default",
            pattern: "{controller=Home}/{action=Index}/{id?}");

In the above example, the UseRouting method is called to enable routing middleware. The UseEndpoints method is then used to define the default route for the application. Make sure that your routing configuration is similar to the above example.

Handling Redirects

If the routing configuration is correct and you are still redirection issues, it is possible that the issue lies with the application's authentication settings. ASP.NET Core provides built-in authentication middleware that can handle redirects based on authentication rules.

To handle redirects, you need to check the authentication settings in your application. Look for any authentication-related code in the Startup.cs file, such as the AddAuthentication and UseAuthentication methods. Ensure that the authentication settings are properly configured.


Here is an example of how to configure authentication using ASP.NET Core Identity:

public void ConfigureServices(IServiceCollection services)
    // Other service configurations

    services.AddAuthentication(options =>
        options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
    .AddOpenIdConnect(options =>
        // OpenID Connect configuration

In the above example, the AddAuthentication method is used to configure the authentication middleware. The AddCookie method adds cookie-based authentication, while the AddOpenIdConnect method adds OpenID Connect authentication. Make sure that your authentication configuration is appropriate for your application's requirements.


In this article, we discussed the issue of ASP.NET Core sites getting redirected to and provided solutions to resolve it. We explored the possible causes of the issue, such as misconfigured routing settings and authentication settings. By checking and adjusting these configurations, you can ensure that your ASP.NET Core site without any unexpected redirections.

Rate this post

Leave a Reply

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

Table of Contents