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]

Developer technologies .NET Blazor
0 comments No comments
{count} votes

2 answers

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

  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.