locked
convenient way to pass a string between pages RRS feed

  • Question

  • User2110873642 posted

    Im using blazor, and all client side data storages are overlay complicated or still in development. it leaves querystring as the easiest alternative. but the problem is that it is a hand full of work to keep passing it over with every anchor manually.

    i need the easiest way to recognise someone. i only want to store a stupid simple ID in the client browser, so that i know who they are between pages and then lookup their data on server side.

    At this moment, this is the main reason why i cannot embrace blazor at all.

    Wednesday, July 22, 2020 11:52 PM

Answers

  • User-821857111 posted

    Assuming that you are using WebAssembly Blazor (you haven't said), you can use something like the AppState solution mentioned at the end of this article: https://chrissainty.com/3-ways-to-communicate-between-components-in-blazor/

    Fundamentally, it's a global variable that is scoped to the current user because the app instance is executing in the user's browser. It's kind of like an implementation of session state on the client.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 23, 2020 6:07 AM

All replies

  • User-821857111 posted

    Assuming that you are using WebAssembly Blazor (you haven't said), you can use something like the AppState solution mentioned at the end of this article: https://chrissainty.com/3-ways-to-communicate-between-components-in-blazor/

    Fundamentally, it's a global variable that is scoped to the current user because the app instance is executing in the user's browser. It's kind of like an implementation of session state on the client.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 23, 2020 6:07 AM
  • User1535942433 posted

    Hi fazioliamboina,

    i need the easiest way to recognise someone.

    Accroding to your description,I don't understand your requirment clearly.What means to recodnise someone.Do you need to communicate between components in Blazor?

    Could you tell more details of your requirment clearly?It will help us to solve your problem.

    Best regards,

    Yijing Sun

    Thursday, July 23, 2020 7:25 AM