hanssens / localstorage

LocalStorage for .NET - A simple and lightweight tool for persisting data in dotnet (core) apps.
MIT License
74 stars 17 forks source link

Unable To Store Anything? #21

Closed YodasMyDad closed 6 years ago

YodasMyDad commented 6 years ago

Maybe this is me, I have installed the Nuget package and setup a test on the page (See Below).

            var localStorage = new LocalStorage();
            try
            {
                var stuffOut = localStorage.Get("stuff");
            }
            catch
            {

            }
            localStorage.Store("stuff", "This is my stuff going in");
            var hmmm = localStorage.Get("stuff");

This seemed to pull the data back out with no issues. However, if I look in in Local Storage in Chrome Inspector it's not in there. And if I refresh the page, it cannot get it back out. I then tried this.

            using (var localStorage = new LocalStorage())
            {
                try
                {
                    var stuffOut = localStorage.Get("stuff");
                }
                catch
                {

                }
                localStorage.Store("stuff", "This is my stuff going in");
                var hmmm = localStorage.Get("stuff");
            }

I then found your blog. And changed the code to this as a test

            using (var localStorage = new LocalStorage())
            {
                localStorage.Store("stuff", "This is my stuff going in");
                localStorage.Persist();
            }

But still. No data is persisted? What am I missing? I assumed this was just install and go? And it stored the data in Local Storage?

nothing

hanssens commented 6 years ago

@YodasMyDad Sorry, it doesn't work that way. Given a quote:

LocalStorage for .NET is inspired by – but totally unrelated to – Javascript’s localStorage; a temporary caching lib for low-demanding data needs.

You'll find the results from your sample in the .localstorage file in the root of your .NET project, instead of in the browser. Again, in short, it has nothing to do with your browser's localStorage, other than being inspired by it.

oscar522 commented 5 years ago

Hola comunidad, de antemano gracias por la atención, efectivamente persist(), garantiza la persistencia de la variable, ahora se presenta este error en mi site de producción, ( "Message": "Access to the path 'C:\inetpub\wwwroot\WebApiClubVivamos\.localstorage' is denied." ), Existe alguna recomendación para solucionarlo ?