0

I need to add a key to my session object on the browser using angular.js. Is this possible?

1
  • 1
    server session or browser storage?... question is quite vague Commented Mar 1, 2013 at 23:38

2 Answers 2

1

It's not possible to change your session from client side.

Sign up to request clarification or add additional context in comments.

1 Comment

it is if OP asking about sessionStorage... but not clear at all what is wanted
0

If you mean changing client-side session window.sessionStorage then just ad key-value with the object.

Otherwise if you want to change server-side session this needs some work. I assume you use some MVC framework. First create an action in a controller which logic should add key-value passed by parameter to you session. Map the action to some path. On client-side you should create service which makes $http.post call to that action path and value as data.

Security hint: Please don't parametrize key name unless you have some security checks server-side. This way malicious user won't be able to modify sensitive key-value in your sessions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.