i am saving some of the users insensitive data in the window.sessionStorage. this data is specific to the browsers tab, now i want to access the data which i have stored in the session storage from server side, how can i do that.
How can we access sessionStorage in server side using MVC?
13.4k views Asked by Lijin Durairaj At
2
You can't.
sessionStorageis something that resides within the browser, on the client machine. ASP.NET MVC resides on your server. You can't simply 'pull' client-side browser data towards your server, the browser has to send it to you.Using JavaScript, you can read whatever is in the session storage and then make an AJAX request to send it to ASP.NET MVC.
Another option is to not store the data in the session storage but inside a cookie. Cookie data gets passed along with every HTTP request that goes out to your server. That way, the data will be immediately accessible in ASP.NET MVC.