473,508 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Values and Javascript?

I have a javascript menu navigation. I have some session values which
regularly get updated, but when i navigate using this Javascript menu
to a different page i'm not able to see the updated session values
where I actually need them, i will be getting only the old ones. And
when i refresh the page i can see the new values.
Is there is way to get around this problem?
Can any one help please?

Jul 11 '06 #1
8 4219
I think what is more likely is that somehow the values are getting reset. It
doesn't matter if javascript or something else is doing the navigation - as
long as there is the same sessionid, you would see those values.

I would look at your code. My guess is that those values are getting reset
somehow to their 'old' values.

Also, I'm not sure what you mean by 'see' the new values. Are you displaying
these values on the page? Perhaps your pages are being cached by the browser
then.

If you are talking about on the server in the code, then I think it is the
case that something is resetting them.

"savvy" <jo******@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>I have a javascript menu navigation. I have some session values which
regularly get updated, but when i navigate using this Javascript menu
to a different page i'm not able to see the updated session values
where I actually need them, i will be getting only the old ones. And
when i refresh the page i can see the new values.
Is there is way to get around this problem?
Can any one help please?

Jul 11 '06 #2
Can it be a caching issue? To rule it out, try adding a random query
parameter to the url you navigate to in javascript.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"savvy" <jo******@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>I have a javascript menu navigation. I have some session values which
regularly get updated, but when i navigate using this Javascript menu
to a different page i'm not able to see the updated session values
where I actually need them, i will be getting only the old ones. And
when i refresh the page i can see the new values.
Is there is way to get around this problem?
Can any one help please?

Jul 11 '06 #3
Did you checked whether the sessions values are updated with the new
values? Please confirm that before doing anything.

--
Vadivel Kumar
http://www.vadivelk.net
va**@online.vadivelk.net (remove "online.")

savvy wrote:
I have a javascript menu navigation. I have some session values which
regularly get updated, but when i navigate using this Javascript menu
to a different page i'm not able to see the updated session values
where I actually need them, i will be getting only the old ones. And
when i refresh the page i can see the new values.
Is there is way to get around this problem?
Can any one help please?
Jul 11 '06 #4
Yes, I'm displaying the values on all the pages,Actually I'm developing
a shopping cart in which I'm displaying a small Item basket on all the
pages which displays number of Items added to the basket and their
total price on all pages.
So for example when I doing Response.Redirect to a Particular Page I
can see the updated values but when i navigate using this javascript
menu its just bringing up the old values ,
I can see that page is not posted back and I think its just bringing up
the cached page (I dont know much about caching! sorry). I think this
is pointing to the Caching Issue Problem
I'm not able to understand how to get over this problem. i've trying
this since 5 days till now
Thanks in advance for your time and help

code...

protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["Total"]) == string.Empty)
{
pllogin.Visible = true;
plbasket.Visible = false;
}
else
{
pllogin.Visible = false;
plbasket.Visible = true;
lblquantity.Text = Convert.ToString(Session["TotQty"]);
lblprice.Text = Convert.ToString(Session["Total"]);
}
}

Jul 11 '06 #5
Thanks everyone for your time
Contd...
Yes, I can see the values are updated and they are not resetted. lets
say in the main basket page if i change the no of items(quantity) so
the total price gets changes as well and these updated values are
supposed to be seen in all pages but if I use the JS Menu and navigate
to a particular page I can see the previous values only and if I
refresh the same page i can see the updated values.
Hope i made myself clear
So, if this is a caching issue how can i update the values in the
cache?

Thanks in Advance

savvy wrote:
Yes, I'm displaying the values on all the pages,Actually I'm developing
a shopping cart in which I'm displaying a small Item basket on all the
pages which displays number of Items added to the basket and their
total price on all pages.
So for example when I doing Response.Redirect to a Particular Page I
can see the updated values but when i navigate using this javascript
menu its just bringing up the old values ,
I can see that page is not posted back and I think its just bringing up
the cached page (I dont know much about caching! sorry). I think this
is pointing to the Caching Issue Problem
I'm not able to understand how to get over this problem. i've trying
this since 5 days till now
Thanks in advance for your time and help

code...

protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["Total"]) == string.Empty)
{
pllogin.Visible = true;
plbasket.Visible = false;
}
else
{
pllogin.Visible = false;
plbasket.Visible = true;
lblquantity.Text = Convert.ToString(Session["TotQty"]);
lblprice.Text = Convert.ToString(Session["Total"]);
}
}
Jul 11 '06 #6
As I suggested in my other response, one of the ways to trick caching is to
add a random query parameter to the url. For example, instead of navigating
to abc.aspx, go to abc.aspx?<here is a random value>.

If you set url in javascript you can use the millisecond part of the current
time:
'abc.aspx?' + (new Date()).getMilliseconds()

If you set url on server side, you can use Random class or whatever else you
find for this matter.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"savvy" <jo******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Yes, I'm displaying the values on all the pages,Actually I'm developing
a shopping cart in which I'm displaying a small Item basket on all the
pages which displays number of Items added to the basket and their
total price on all pages.
So for example when I doing Response.Redirect to a Particular Page I
can see the updated values but when i navigate using this javascript
menu its just bringing up the old values ,
I can see that page is not posted back and I think its just bringing up
the cached page (I dont know much about caching! sorry). I think this
is pointing to the Caching Issue Problem
I'm not able to understand how to get over this problem. i've trying
this since 5 days till now
Thanks in advance for your time and help

code...

protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["Total"]) == string.Empty)
{
pllogin.Visible = true;
plbasket.Visible = false;
}
else
{
pllogin.Visible = false;
plbasket.Visible = true;
lblquantity.Text = Convert.ToString(Session["TotQty"]);
lblprice.Text = Convert.ToString(Session["Total"]);
}
}

Jul 11 '06 #7
Eliyahu Goldin, I dont know how to convey my thanks to u
it worked perfectly mate, i've been struggling to solve this problem
I didn't have got this trick
Thank u very very much
I can only wish with all my heart for your success in what ever u do
mate
Thank u very much for your time

Jul 11 '06 #8
I can only wish with all my heart for your success in what ever u do

Thank you.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
Jul 11 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1571
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL:...
3
12379
by: Enoch Chan | last post by:
I would like to set a Session variable to a value. In Vbscript it should be Session("ZoomValue")=500 How can I set this session variable by using Javascript? Thanks
2
6154
by: Joe Molloy | last post by:
Hi, This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious. I have developed a shopping cart for an application I'm working on...
3
9546
by: Timo | last post by:
In javascript code on MyPage.aspx, I set a hidden IFRAME's source url: myframe.location.href = 'someotherpage.aspx'; If the session has timed out, preventing someotherpage.aspx from being...
14
2164
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
0
1132
by: savvy | last post by:
I am developing a shopping cart in which for the top-menu navigation I'm using Javascipt.I have a small Item basket which shows up in all the pages when an Item is added to the main basket. And i'm...
1
2569
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
4
19989
by: philin007 | last post by:
Hi , I have the following javascript codes: ****************************************** <script language="JavaScript"> <!-- .... ..... if (nextRow >5) {
6
5121
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.