Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve a value from the local storage in c# code?

I'm passing a value in local storage from one view and i want to call this value in another view in c# function. Both action results are in same controller. I don't know how to call this local storage value in c# can any one help me ?

   view1.cshtml:
   <script>
   ...
    var audioElement = document.getElementById(audioId);
            // Check browser supporta
            if (typeof (Storage) !== "undefined") {
                //Store
                localStorage.setItem("audiourl", audioElement);

                //Retrieve
                document.getElementById("result").innerHTML = localStorage.getItem["audiourl"];
             }
   </script>
 <div id="result"></div>

By doing this value has been passed, now how to receive this value from localstorage in another view in c# function as a parameter.

like image 868
dania Avatar asked Nov 11 '15 11:11

dania


1 Answers

Local storege is on the client-side. It isn't sent to the server, and cannot be accessed from server code.

If you need it in your server code, you'll have to explicitly send it yourself.

like image 136
Luaan Avatar answered Oct 12 '22 22:10

Luaan