- ABP Framework version: v8.0.0
- UI Type: Blazor Server
- Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
- Tiered (for MVC) or Auth Server Separated (for Angular): no
- Exception message and full stack trace:
- Steps to reproduce the issue: How can I clear all session storage after logout? ISessionStorage does not allow in LogoutModel as we need to implement it in OnAfterRender
8 Answer(s)
-
0
Hello ,
Please check this solution if it works for you https://stackoverflow.com/questions/77204224/how-to-clear-all-the-sessions-using-protectedsessionstorage-in-blazor-server-app.
Thank you.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
As I mentioned, it raises error InvalidOperationException: JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.
There is no method OnAfterRenderAsync in LogoutModel to overwrite
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
You can try this:
public partial class Index { [SupplyParameterFromQuery] public string Page { get; set; } [Inject] public IJSRuntime JsRuntime { get; set; } protected async override Task OnInitializedAsync() { if (Page == "/Account/~/Account/Login") { await JsRuntime.InvokeVoidAsync("sessionStorage.clear"); } } }Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Thank you, this solution seems work for me BTW, I added to OnAfterRenderAsync protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { //Temporary solution to clear session storage if (Page == "/Account/~/Account/Login") { await jsRuntime.InvokeVoidAsync("sessionStorage.clear"); } } await base.OnAfterRenderAsync(firstRender); }
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
It's ok.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
