Cookie & Blazor Server-side

Kevin Azure 141 Reputation points
2023-05-05T00:42:14.6166667+00:00

Is Cookie supported by Blazor Server-side?

How to use Cookie to store Login/Session information?

[so the duplicate login prompt won't come for N days]

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,458 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. S.Sengupta 16,561 Reputation points MVP
    2023-05-05T00:55:31.1066667+00:00
    0 comments No comments

  2. Bruce (SqlWork.com) 59,306 Reputation points
    2023-05-05T17:26:35.2766667+00:00

    Blazor server uses cookie authentication. Just config the identity cookie the way you would for any asp.net core website.

    when blazor server needs authentication it redirects to the login, which unloads the app. Then after login redirects back, the app is reloaded. Unless saved, all state values will be lost. You can avoid this by requiring authentication if the hosting page.

    note: typically with blazor WASM you would use bearer tokens.