Open Closed

401 page flashes and does not jump to the login page #6692


User avatar
0
327992883@qq.com created
  • ABP Framework version: v7.2.3

  • 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:2024-02-05 16:25:32.378 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.IdentityUserClientProxy.GetAssignableRolesAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.378 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.378 +08:00 [ERR] 执行异常处理401过期,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.378 +08:00 [WRN] Unhandled exception rendering component: Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.IdentityUserClientProxy.GetAssignableRolesAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.378 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.OrganizationUnitClientProxy.GetListAllAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.GetOrganizationUnitsAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.379 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.379 +08:00 [ERR] 执行异常处理401过期,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.379 +08:00 [WRN] Unhandled exception rendering component: Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.OrganizationUnitClientProxy.GetListAllAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.GetOrganizationUnitsAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.380 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.IdentityUserClientProxy.GetExternalLoginProvidersAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.Components.IdentityUserImportDropdownComponent.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.380 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.380 +08:00 [ERR] 执行异常处理401过期,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.380 +08:00 [WRN] Unhandled exception rendering component: Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.IdentityUserClientProxy.GetExternalLoginProvidersAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.Components.IdentityUserImportDropdownComponent.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.380 +08:00 [INF] Received HTTP response headers after 64.4974ms - 401 2024-02-05 16:25:32.380 +08:00 [INF] End processing HTTP request after 64.705ms - 401 2024-02-05 16:25:32.380 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Saas.Host.ClientProxies.EditionClientProxy.GetListAsync(GetEditionsInput input) at Volo.Saas.Host.Blazor.Pages.Saas.Host.TenantManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.380 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.380 +08:00 [ERR] 执行异常处理401过期,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.380 +08:00 [WRN] Unhandled exception rendering component: Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Saas.Host.ClientProxies.EditionClientProxy.GetListAsync(GetEditionsInput input) at Volo.Saas.Host.Blazor.Pages.Saas.Host.TenantManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.381 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.OrganizationUnitClientProxy.GetListAllAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.GetOrganizationUnitsAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.381 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.381 +08:00 [ERR] 执行异常处理401过期,HttpStatusCode--401,Message--Unauthorized 2024-02-05 16:25:32.381 +08:00 [WRN] Unhandled exception rendering component: Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.OrganizationUnitClientProxy.GetListAllAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.GetOrganizationUnitsAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.OrganizationUnitsManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.382 +08:00 [ERR] Unauthorized Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync(ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](ClientProxyRequestContext requestContext) at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) at Volo.Abp.Identity.IdentityUserClientProxy.GetAssignableRolesAsync() at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-02-05 16:25:32.382 +08:00 [ERR] 执行异常处理逻辑,HttpStatusCode--401,Message--Unauthorized

  • Steps to reproduce the issue:After staying on the page for a few hours, click the query button of the page again. The status is 401 but it will not jump to the login page. The page will keep flashing. AbpComponentsBase is not used, but a custom base class, in which the exception handling code:

  • ` protected override async Task OnErrorAsync(Exception exception) { if (IsDisposed) return;

           Logger.LogError(new EventId(0, "Global Exception"), exception: exception, message: exception.Message);
           if (exception is AbpRemoteCallException)
           {
               var ex = exception as AbpRemoteCallException;
               Logger.LogError($"Execute exception handling logic, HttpStatusCode--{ex.HttpStatusCode},Message--{ex.Message}");
    
               //401 error returns to the original exception handling mechanism and allows the front desk to jump
               if (ex.HttpStatusCode == (int)HttpStatusCode.Unauthorized)
               {
                   Logger.LogError($"Execution exception handling 401 expired, HttpStatusCode--{ex.HttpStatusCode},Message--{ex.Message}");
                   await base.OnErrorAsync(exception);
                   return;
               }
    
               await UiMessageService.Info(ex.Error.Message, ex.Error.Code);
               return;
           }
    
           //await base.OnErrorAsync(exception);
           if (exception is UserFriendlyException)
           {
               var ex = exception as UserFriendlyException;
               await UiMessageService.Info(ex.Message);
               return;
           }
    
           if (exception is BusinessException)
           {
               var ex = exception as BusinessException;
               await UiMessageService.Warn(ex.Message, ex.Code);
               return;
           }
           await UiMessageService.Error(exception.Message);
       }`
    

4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The page will keep flashing. AbpComponentsBase is not used, but a custom base class, in which the exception handling code:

    Please share a test template project with your custom code. liming.ma@volosoft.com

    Thanks.

  • User Avatar
    0
    327992883@qq.com created

    hi

    The page will keep flashing. AbpComponentsBase is not used, but a custom base class, in which the exception handling code:

    Please share a test template project with your custom code. liming.ma@volosoft.com

    Thanks.

    Already send for your email

  • User Avatar
    0
    327992883@qq.com created

    Hi,you can try running the project and stay on the testing book list. After an hour of token expiration, clicking the query button again will cause the page to flicker continuously until the program crashes.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your OnDataGridReadAsync method keeps calling the GetBooksAsync during exceptions.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09