Data storage is a vital function for applications that want to monitor user progress, enable login or perform various other functions. There are a variety of ways to store data about users, but the most effective solution depends on the problem you’re trying to solve.
Local storage is a fantastic way to store small amounts of data, like login and registration information for users that don’t require immediate sync. However, it’s limited by the size of the hard drive and is only accessed with client-side code (and cannot be modified through server-side scripts). Also local storage is vulnerable to loss of data when the application is deleted or the device is reset.
Database storage is a great option for storing large amounts of data that might need to be edited. It enables you to keep the track of your users’ data by keeping their unique identifiers in an existing database table, and using that identifier whenever you access the database. This is more complicated than other data storage options however it is suitable for large or enterprise applications that need to store user data across multiple sessions.
WebView2 uses UDFs to store information about the browser, including cookies, permissions, and cached resources. The data expires according to the user’s Web and App Activity settings and can be manually cleared by the user using Actions on Google. You must select a UDF that has Write access to the WebView2 to store additional user data. See the WinUI 3.cs file in the WebView2Samples repo http://www.virtuadata.net/how-to-service-your-own-computer for an example of how to do this with ICoreWebView2Environment7.
