473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why session variables are not passed between pages?

I have two ASP .NET web forms A and B. A is a web form that geneates a binary graph and create some session variables before generate the graph. B is the display page which calls the A and display the graph generated by A. The code in B is like this:

<img width="" height="" src="graph.aspx?a=3&b=4">
<% Response.write(Session("numOfBars")) %>

graph.aspx is the file name of A, and "numOfBars" is a session variable created in A just before the graph is generated. My problem is the graph is displayed corretly in B, but B cannot get any session variable created by A. It seemed session variables are not passed to B at all. However, if I use
Response.redirect(B) in A, then I can print all session variables created by A. How can I pass session variables created in A to B without any redirection. Put it in another way, if B just calls A, why B can't see the session variable created by A? How can I pass them from A to B in this situation?

I tried all best but still couldn't solve the problem. Any suggestion or reference link is greatly appreciated.

-John
Oct 16 '06 #1
4 2774
bharathreddy
111 100+
Dear John,

Here one thing that we should note is, in B you are showing A (that is graph).
So first the B Page_Load event will take place then A Page_Load. B will load first then A will be loaded so u cant get the session variables in B.

Summary:
These session variables in A are assigned after B Page_Load.


with Regs
Bharath Reddy
+919866560927
India
Oct 17 '06 #2
Bharath,

Thank you very much for your reply. I'm newbie for asp .net. In my case, how can I get session variables created in A? or, how can I force a page_load event of A to occur before B's page_load event? Is there other way to get the session variables without a page_load event? Thanks in advance for further suggestion.

-John
Oct 17 '06 #3
bharathreddy
111 100+
Dear John,

I dont know the answer but i can sujest u to go for other options like save the data which u want to store in the sessions in an xml file and read that file when u want or use database for the same.

But even this will not work in your case because B Page_Load and UnLoad events will fire first before A's Page_Load fires. (Simple reason behind this is we cant read a value before it is set).
I got the same problem I took frames instead of img tag. The problem solved. In first frame keep the A page and in the second frame keep B. In this case A will be loaded first and then B so u will get the session values set in page A.

Note:
-------
Passing values from one page to another is by : session, cookies , querystring and database/xml. Using any of these we cant achive your case. So i think u need to go with frames.

Bharath Reddy
Oct 17 '06 #4
scripto
143 100+
start with the easy things first - check your browser settings - you must accept cookies for Session variables to work. Also if you touched your web config file, make sure accept cookies is turned on.

Give that a try first.
Oct 17 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
5
by: Larry Woods | last post by:
I am losing Session variables, but only those that are set in the page previous to a redirect to a secure page. Anyone seen ANY situation where Session variables just "disappear?" Note that...
14
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...
22
by: K. A. | last post by:
I have two servers at work, 'A' for testing and development, and server 'B' for production. On server A, I wrote a PHP test code to login users then direct them to a personalized page. This is...
5
by: manny6677 | last post by:
Trying a simple test of passing $_SESSION variables between two php pages. I don't see any data on the second page and the session id that is printed out is not the same as the first page session id...
1
by: KidQuin | last post by:
I am having problems with session value between pages. Happening in both firefox and IE7. I go between page by links so I know it's not header changes. I use session_start as the first line on the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.