Are you using Radzen to create those pages? The thread category suggests so but the code you have provided does not look as something Radzen would produce.
Hello whether you are using Radzen or Visual Studio version of Blazor, you have three options
Pass the value as a parameter. Look this up. But this is not secure because users can see the value you passed.
Used Blazored.Session storage package from nuget. This also is not secure
3.Use ProtectedSessionStorage from Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage package. This third option is secure. See code snippet below:-
//first page
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
public partial class FirstPageComponent
{
[Inject]
private async Task SetOrderID()
{
int orderID=10;
await sessionStorage.SetAsync("NewOrderID", orderID);
UriHelper.NavigateTo("SecondPage");//code to redirect to second page
}
}
//second page
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
public partial class SecondPageComponent
{
[Inject]
All of that works up until now, but benjamin suggested the .ProtectedBrowserStorage at the end of the Microsoft.AspNetCore.Components.Server and it can't find that or doesnt recognise it, am i doing something wrong?
@using Microsoft.AspNetCore.Components.Server;
//when i add .ProtectedBrowserStorage at the end of the using statement,
//it doesnt recognise it
Use the latest .NET 5.0 SDK or latest version of RADZEN. I can confirm that it is automatically available in the latest version of RADZEN. I will upload my video on this very soon and update you guys