As in question. Is it possible to set variable in asp.net page in localStorage and retrieve it on the other page?
How to set localStorage variable in asp.net. Is it
Old post yes, but knowledge is always good.
You can set the local or session storage from asp.net (indirectly). Since we can set up javascript code in asp.net and insert into the client side, there's no difference with the session or local storage.
Try this from server side
string script = string.Format("sessionStorage.userId= '{0}';", "12345");
ClientScript.RegisterClientScriptBlock(this.GetType(), "key", script, true);
That will set the session (you could do local) storage variable to the value 12345.