The framework version for our ecommerce site, which was created with asp.net(vb.net), is 4.7.2. This current application will be changed to a blazor application (7.0). We employ the incremental conversion strategy, which means that until the asp.net program is completely transformed into a blazor app, two apps will be operating. Assume we used Blazor to transform some pages. In the current asp.net application, sessions are used, for instance, session("OrderId"). I also want to access or modify the value of the Blazor application's session("OrderId") variable.
I tried to follow the instruction, but I was unable to make it work in my applications (the sharing session section of the tutorial is a little different from my situation).- devblogs.microsoft.com/dotnet/migrating-from-asp-net-to-asp-net-core-part-4/.
Since this github application is extremely comparable to our website, you can look at it. github.com/dotnet-architecture/eShopOnBlazor/tree/main/src To switch to eShopOnBlazor from eShopLegacyWebForms. How can sessions be shared between the two projects?
Is there anyone have an idea how to share sessions between ASP.NET webforms and a Blazor application?
Mohamed Azarudeen ZPosted Jul 8, 2023, 3:45 AM
To share session data between the ASP.NET WebForms and Blazor applications, you may consider using a common session storage mechanism that both applications can access. Here are a few approaches you can explore:
Use a shared backend service: Create a separate backend service or API that both applications can communicate with to store and retrieve session data. This service can act as a centralized session store, allowing both applications to access and update session variables.
Utilize a database or cache: Store the session data in a shared database or cache system that both applications can access. This way, the data can be retrieved and updated by both the WebForms and Blazor applications.
Leverage browser storage: If the session data is not sensitive and can be stored locally, you can use browser storage mechanisms like local storage or session storage to share data between the applications. Both WebForms and Blazor can read from and write to these browser storage mechanisms.