From the course: Advanced Blazor WebAssembly
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
The difference between localStorage and sessionStorage
From the course: Advanced Blazor WebAssembly
The difference between localStorage and sessionStorage
- [Instructor] If a user creates data, and it's only stored in the browser memory, that data will be lost once the user closes the browser. To preserve state across multiple browser sessions the app must store the data to another storage location. Service side storage is good for permanent data, that persists across multiple users and devices. Options include blob storage, key-value storage, relational database like SQL Server, and table storage. As Blazer WebAssembly is a client-side application, additional security measures need to be taken into consideration when accessing storage. Such as authenticating through OAuth or OpenID Connect. For the data that the user is collecting, they can use browser storage locations, such as local storage and session storage. LocalStorage is scoped to the browser's window. The state is persisted across multiple tabs and even when the browser is closed and reopened. It's only cleared when it's…