Learn More, Pay Less!
Limited Time Offer!
Open Closed

404 error after clicking login button #8636


User avatar
0
jacek.bialy created
  • ABP Framework version: v9.0.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

We have an issue that occasionally becomes visible. It happens only on our environment on Azure. Locally, we are unable to reproduce it.

  • Click the "Login" button on the portal:

  • After about 1s the main content of portal disappears (menu is still visible) and a 404 error appears and it's visible for about another 1s
  • Then, there's a redirect to the auth server, where the correct login form appears

Do you have any ideas about what might be causing this? We've analyzed logs and browser console, but with no success. As i said it happens from time to time and in my opinion it existed also on v8 version of ABP. If needed, I can share the URL of our test environment and movie with the issue presented via email.


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the full logs?

    If needed, I can share the URL of our test environment and movie with the issue presented via email.

    yes , please. my email is shiwei.liang@volosoft.com

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you try updating routes.razor and share the logs again?

    @using Microsoft.Extensions.Options
    @using Microsoft.Extensions.Localization
    @using global::Localization.Resources.AbpUi
    @using Microsoft.Extensions.Logging
    @using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme
    @using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components
    @using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout
    @using Volo.Abp.AspNetCore.Components.Web.Theming.Routing
    @using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp
    @inject IOptions<AbpRouterOptions> RouterOptions
    @inject IOptions<LeptonXThemeBlazorOptions> LayoutOptions
    @inject IStringLocalizer<AbpUiResource> UiLocalizer
    @inject ILogger<Routes> Logger
    @inject NavigationManager NavigationManager
    
    <CascadingAuthenticationState>
        <Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
            <Found Context="routeData">
                <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@LayoutOptions.Value.Layout">
                    <NotAuthorized>
                        @if (context.User?.Identity?.IsAuthenticated != true)
                        {
                            <RedirectToLogin/>
                        }
                        else
                        {
                            <ErrorView
                                Title="@UiLocalizer["403Message"]"
                                HttpStatusCode="403"
                                Message="@UiLocalizer["403MessageDetail"]"/>
                        }
                    </NotAuthorized>
                </AuthorizeRouteView>
            </Found>
            <NotFound>
                <LayoutView Layout="@LayoutOptions.Value.Layout">
                    @{
                        Logger.LogWarning($"404 Not Found. Path: {NavigationManager.Uri}");
                    }
                    <ErrorView
                        Title="@UiLocalizer["404Message"]"
                        HttpStatusCode="404"
                        Message="@UiLocalizer["404MessageDetail"]"/>
                </LayoutView>
            </NotFound>
        </Router>
    </CascadingAuthenticationState>
    
    
  • User Avatar
    0
    jacek.bialy created

    Done :)

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Will it work if you try this:

    Index.razor

    <Button Clicked="Login">Login</Button>
    

    Index.razor.cs

    [Inject] public NavigationManager Navigation { get; set; }
    
    protected override void Login()
    {
        Navigation.NavigateTo($"account/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}", true);
    }
    
  • User Avatar
    0
    jacek.bialy created

    It looks like that was the issue. Now 404 error does not occur anymore.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    okay, I will fix the problem in the next version.

Made with ❤️ on ABP v9.2.0-preview. Updated on February 10, 2025, 13:23