Is there a way in ASP.Net MVC, in controller to access a variable in sessionstorage or localstorage?

2

I need to get the value of a variable stored in the sessionstorage through a controller where this method is not passed the parameter of this variable.

Session / localstorage are administered through javascript. In contrast situations it is easy to get the value of variables in C # through AJAX and several other ways.

But what I need is the opposite. Can you do it?

    
asked by anonymous 01.02.2014 / 19:33

1 answer

4

You can use SignalR , which is a project developed by Microsoft so that the server can communicate with the browser, and send information to the same, and then back to the server.

You can install SignalR via NuGet:

Install-Package Microsoft.AspNet.SignalR

Or by the Visual Studio package manager.

SignalR is very easy to use, there is a tutorial to use SignalR .

To get a value in the browser, you have to send a message to the browser, and when you hear that message on the client, send another message to the server, with the desired value.

    
01.02.2014 / 20:44