Getting ready

First, we create an empty project with VS 2017, and use JavaScript code to store data.

We need as a minimum browser requirement IE8, Firefox 3.5, or Chrome 4.0 to benefit from HTML5 capabilities in the browser.

All the following methods and properties are available for both localStorage and seesionStorage:

  • getItem(key): Store a key/value pair
  • setItem(key, value): Return a value associated with a key
  • removeItem(key): Delete a key/value pair with a key
  • clear(): Delete all key/value pairs
  • length: Return the number of stored pairs

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.