1
I am creating several Séssions, and would like to get the name and value of all by Javascript.
When creating two Sessions in Asp.Net MVC, for example:
Session["usuario"] = "user";
Session["tipo"] = "comum";
I’d like to get both Sesssions on View, without knowing their name.
Example:
<script>
var sessions = getTodasAsSessions(); // Existe alguma função desse tipo?
for(var i = 0; i < sessions.length; i++){
alert("Nome da Session: " + sessions[i].Name + " Valor: " + sessions[i].Value);
}
</script>
That’s possible?
I believe that not because it would open a security breach, but what is the purpose of it?
– Maicon Carraro
You want to pick up the front-end sessions?
– Guilherme Nascimento
Exact Guilhermenascimento.
– Jedaias Rodrigues
Maiconcarraro, I am doing a project where depending on the type of user I create several different Sesssions, and I have to recover them in the View. It really makes sense the issue of security, but cryptography would not solve?
– Jedaias Rodrigues
Given that you were able to implement the
getTodasAsSessions()
, What are you going to do with it? You’re going to use this to selectively render things on the front end, to advance the permission errors, ...?– user25930
I haven’t implemented it yet
getTodasAsSessions
.– Jedaias Rodrigues