VS 2008 Timer and Session question

J

Jason Huang

Hi,

In my .Net 3.5 C# VS 2008, I have Timer on some pages.
My question is regarding the Session and the Timer.
The SessionA is created on A.aspx, and later on the B.aspx use the
SessionA's value to do some processes.
However, the C.aspx doesn't use the SessionA at all.
If I wanna keep the SessionA alive until user close the web applications,
how do I use the Timer to achieve this goal?
Thanks for help.


Jason
 
P

Peter Duniho

Hi,

In my .Net 3.5 C# VS 2008, I have Timer on some pages.
My question is regarding the Session and the Timer.
The SessionA is created on A.aspx, and later on the B.aspx use the [...]

You should post your question to the ASP.NET newsgroup where it's
on-topic. You're much more likely to get a useful answer there.
 
F

Family Tree Mike

Jason said:
Hi,

In my .Net 3.5 C# VS 2008, I have Timer on some pages.
My question is regarding the Session and the Timer.
The SessionA is created on A.aspx, and later on the B.aspx use the
SessionA's value to do some processes.
However, the C.aspx doesn't use the SessionA at all.
If I wanna keep the SessionA alive until user close the web applications,
how do I use the Timer to achieve this goal?
Thanks for help.


Jason

The following works as long as A.aspx and B.aspx are part of the same
application.

In A.aspx.cs:
Session ["SessionA"] = SomeObject;

In B.aspx.cs:
Label1.Text = Session ["SessionA"].ToString();

There is no timer needed for any of this. As long as the server session
is active (no session timeout, browser does not close), then the session
hash is still alive. In fact, there probably is never a need for a
timer in a server piece of code, but others may have an instance where
it is appropriate.

If A.aspx, and B.aspx are in different web applications, then as Pete
says, this is definitely the wrong group for the post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top