A session is being passed after successful login from a aspx page to an html page, i want to be able to get the session object using JSON and modify html elements, can anyone post a simple example on how to do that using JSON ?
thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You will need to make a AJAX call from the clientside to a web service method or a page method (webmethod defined in your page).
If you choose for the page method option your code could be something like this:
Your code behind of your Page.aspx
I would not advise to always give back all the session vars. Make it explicit and give only back the ones you need. This way if on a later moment in time a other developer adds more user session vars they will not be returned as well. If you do this, it might be a security leak in the future.
Using JQuery for making the AJAX call.
Also read this for some more info.