Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Team, I am storing & retrieving kendo grid data using localstorage. It's working if the user is log-in. If the user log-out,localstorage data clear. When user clicks on signout, I just clear cookies, but localstorage data automatically clear.

I just want to retrieve localstorage data after user log-in, also not clear localstorage data if user log-out or SignOut.

FYI -
I have localstorage data - Dev Tool Image

What I have tried:

I tried -

public RedirectResult SignOut()
        {
            string[] myCookies = HttpContext.Request.Cookies.AllKeys;
            foreach (string cookie in myCookies)
            {
                var httpCookie = HttpContext.Response.Cookies[cookie];
                if (httpCookie != null)
                    httpCookie.Expires = DateTime.Now.AddDays(-1);
            }
            Session.Clear();
            string redirectUrl = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString();
            return Redirect(redirectUrl);
        }
Posted
Comments
Afzaal Ahmad Zeeshan 22-Feb-19 8:17am    
You need to capture that information inside the browser, somehow you might have to send a notification to the browser to upload the data to server. Otherwise, that data cannot be known to the server.

SignalR can be a good thing to look into for this.
RajendraKhandekar5525 25-Feb-19 0:40am    
I already saved it to localstorage. But i just want to if user signout, this data will not be cleared unless manually. pls click on "Dev Tool Image", FYI
Afzaal Ahmad Zeeshan 25-Feb-19 16:06pm    
Normally localStorage data is not cleared automatically—unless you are using the same for session data, as session might be cleared automatically.
RajendraKhandekar5525 26-Feb-19 0:51am    
thanks for quick response, @Afzaal Ahmad Zeeshan. ya I know,localStorage data is not cleared automatically. I just clear session as well as cookies(as per my code). In those cookies, I have got only two instances one is asp.net_sessionid and 2nd is .aspxauth.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900