Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I get and set a session variable from client script?

Posted on 2008-10-15
3
Medium Priority
?
557 Views
Last Modified: 2012-05-05
Hi,

I have a problem where I need to read the current value of a session variable, do some calculations in the client side javascript and then set the same session variable to a new value.  Some quick searches indicate that it can be done using some AJAX.NET library but I am already using the ASP.NET 3.5 SP1 framework and AJAX Toolkit.  Is there some way I can do this without adding the AJAX.NET library?

Thanks!
0
Comment
Question by:TerryDean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Assisted Solution

by:rlh68
rlh68 earned 200 total points
ID: 22724610
Store you session variable in a cookie (if possible) then just read and update the cookie from client side javascript without the AJAX call.
0
 
LVL 2

Accepted Solution

by:
JasonChandler earned 1600 total points
ID: 22724624
You can not set a session via Javascript. Please see this link, you will have to use page methods I think which will be possible since you are using 3.5
http://weblogs.asp.net/sohailsayed/archive/2008/02/23/calling-methods-in-a-codebehind-function-pagemethods-from-client-side-using-ajax-net.aspx
0
 
LVL 13

Assisted Solution

by:sm394
sm394 earned 200 total points
ID: 22724728
Assign Session value to Hidden Fileld which you can access on client side with Javascript like this
var session=document.getElementById('<%=hdnTest.ClientID%>')
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question