473,385 Members | 1,647 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.

Session[]

Do we have any access to the Session[] object from a different Session? The
idea is to save Session[] of a current user and then if he logs in again
then return the Session back. It's not a problem to store, there is only one
complicated object in this Session[], but to get it on SessionStart to make
a copy this is a problem.

Maybe using Application[] or whatever? Or this data is divided and
inaccessible anyway?

Just D.
Nov 19 '05 #1
5 2055
Just D. wrote:
Do we have any access to the Session[] object from a different Session? The
idea is to save Session[] of a current user and then if he logs in again
then return the Session back. It's not a problem to store, there is only one
complicated object in this Session[], but to get it on SessionStart to make
a copy this is a problem.

The session configuration element in web.config has a timeout attribute
which controls how long a session is considered valid. The session
timeout is a sliding value; on each request the timeout period is set to
the current time plus the timeout value.
If you need the session to be valid "forever", like session at
Amazon.com or similar, you should use SQL Server Mode. In SQL Server
Mode the session data is kept in the database.

For good coverage of session state in ASP.NET read Rob Howards MSDN
article on the topic
http://msdn.microsoft.com/library/de...sp12282000.asp

ASP.NET 2.0, which is released later this year, has a Profile API. This
API lets you define profile data which is automatically persisted for
both authenticated and anonymous users between visits to a web site.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 19 '05 #2
Thanks for the article, it's very interesting.

I know about the session timeout. The problem is little bit different. I
don't need cookies. The idea is if the client wants for some reason to use
another machine and uses his login then I need to "transfer" his session to
this new machine, i.e. copy the information stored in some
Sesson["SomeObject"] to another session and then finally start this session.
The previous one should be eliminated at the same time. If the timeout
occured then the Session[] should be serialized and stored on the database
to restore again whenever the client needs that. That's why I need to know
if it's possible and how if yes to copy data from the previous session to a
new one.

Just D.

"Anders Norås" <an**********@objectware.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Just D. wrote:
Do we have any access to the Session[] object from a different Session?
The idea is to save Session[] of a current user and then if he logs in
again then return the Session back. It's not a problem to store, there is
only one complicated object in this Session[], but to get it on
SessionStart to make a copy this is a problem.

The session configuration element in web.config has a timeout attribute
which controls how long a session is considered valid. The session timeout
is a sliding value; on each request the timeout period is set to the
current time plus the timeout value.
If you need the session to be valid "forever", like session at Amazon.com
or similar, you should use SQL Server Mode. In SQL Server Mode the session
data is kept in the database.

For good coverage of session state in ASP.NET read Rob Howards MSDN
article on the topic
http://msdn.microsoft.com/library/de...sp12282000.asp

ASP.NET 2.0, which is released later this year, has a Profile API. This
API lets you define profile data which is automatically persisted for both
authenticated and anonymous users between visits to a web site.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/

Nov 19 '05 #3
I don't have the solution to your problem, but the normal approach would be
to persist your users' data in a database between sessions, and load them up
each time the user logs in. So you would have a different *session* each
time. I hope that makes sence.

Michal

--
Michal Boleslav Mechura
va******@hotmail.com

"Just D." <no@spam.please> wrote in message
news:iL8Kd.978$Jt.294@fed1read02...
Thanks for the article, it's very interesting.

I know about the session timeout. The problem is little bit different. I
don't need cookies. The idea is if the client wants for some reason to use
another machine and uses his login then I need to "transfer" his session
to this new machine, i.e. copy the information stored in some
Sesson["SomeObject"] to another session and then finally start this
session. The previous one should be eliminated at the same time. If the
timeout occured then the Session[] should be serialized and stored on the
database to restore again whenever the client needs that. That's why I
need to know if it's possible and how if yes to copy data from the
previous session to a new one.

Just D.

"Anders Norås" <an**********@objectware.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Just D. wrote:
Do we have any access to the Session[] object from a different Session?
The idea is to save Session[] of a current user and then if he logs in
again then return the Session back. It's not a problem to store, there
is only one complicated object in this Session[], but to get it on
SessionStart to make a copy this is a problem.

The session configuration element in web.config has a timeout attribute
which controls how long a session is considered valid. The session
timeout is a sliding value; on each request the timeout period is set to
the current time plus the timeout value.
If you need the session to be valid "forever", like session at Amazon.com
or similar, you should use SQL Server Mode. In SQL Server Mode the
session data is kept in the database.

For good coverage of session state in ASP.NET read Rob Howards MSDN
article on the topic
http://msdn.microsoft.com/library/de...sp12282000.asp

ASP.NET 2.0, which is released later this year, has a Profile API. This
API lets you define profile data which is automatically persisted for
both authenticated and anonymous users between visits to a web site.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/


Nov 19 '05 #4
Yes, it was the original idea. The problem is deeper. Each session has some
timeout. IF the user closes his browser then I can understand that and send
the command to close the session, serialize data, etc. But if the user loses
the connection then the server size knows nothing about it, so the data is
not serialized and not saved, it remains in Session until the timeout when I
can serialize and save it. Imagine also that - the user goes to a different
computer and opens another session, he wants to get the data that have been
in work before, but the data is not saved, it's still in the previous
session.

As a possible solution is just to serialize data every time and save on the
database. So, each time when the Session object updates we save data. We're
good, the server is dead. Imagine 500 clients for example and how XML
serialization increases the object size. I don't like to serialize the
session object every time it changes.

So the reasonable would be just to catch the previous session in memory and
copy all objects, actually only one big, from previous session to a new one.

I think I could use Application[] instead od Session[], it will work with
some modifications, slower, but more or less acceptable. But the question
about Session still remains alive. This way is more elegant. Maybe it's not
very bad idea to store the reference to this object in Application as
well... I will see how it works.

Just D.

"Michal Boleslav Mechura" <va******@hotmail.com> wrote in message
news:11***************@ns1-ext.dcu.ie...
I don't have the solution to your problem, but the normal approach would be
to persist your users' data in a database between sessions, and load them
up each time the user logs in. So you would have a different *session* each
time. I hope that makes sence.

Michal

--
Michal Boleslav Mechura
va******@hotmail.com

"Just D." <no@spam.please> wrote in message
news:iL8Kd.978$Jt.294@fed1read02...
Thanks for the article, it's very interesting.

I know about the session timeout. The problem is little bit different. I
don't need cookies. The idea is if the client wants for some reason to
use another machine and uses his login then I need to "transfer" his
session to this new machine, i.e. copy the information stored in some
Sesson["SomeObject"] to another session and then finally start this
session. The previous one should be eliminated at the same time. If the
timeout occured then the Session[] should be serialized and stored on the
database to restore again whenever the client needs that. That's why I
need to know if it's possible and how if yes to copy data from the
previous session to a new one.

Just D.

"Anders Norås" <an**********@objectware.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Just D. wrote:
Do we have any access to the Session[] object from a different Session?
The idea is to save Session[] of a current user and then if he logs in
again then return the Session back. It's not a problem to store, there
is only one complicated object in this Session[], but to get it on
SessionStart to make a copy this is a problem.
The session configuration element in web.config has a timeout attribute
which controls how long a session is considered valid. The session
timeout is a sliding value; on each request the timeout period is set to
the current time plus the timeout value.
If you need the session to be valid "forever", like session at
Amazon.com or similar, you should use SQL Server Mode. In SQL Server
Mode the session data is kept in the database.

For good coverage of session state in ASP.NET read Rob Howards MSDN
article on the topic
http://msdn.microsoft.com/library/de...sp12282000.asp

ASP.NET 2.0, which is released later this year, has a Profile API. This
API lets you define profile data which is automatically persisted for
both authenticated and anonymous users between visits to a web site.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/



Nov 19 '05 #5
one session does not have access to another. but you have several options.
you could serialze out the session data that applies to a user, and store it
in a db rather than session. if you want in memeory, store references to the
user session objects in a static hashtable, application object, or
application cache.

-- bruce (sqlwork.com)
"Just D." <no@spam.please> wrote in message
news:iL8Kd.978$Jt.294@fed1read02...
| Thanks for the article, it's very interesting.
|
| I know about the session timeout. The problem is little bit different. I
| don't need cookies. The idea is if the client wants for some reason to use
| another machine and uses his login then I need to "transfer" his session
to
| this new machine, i.e. copy the information stored in some
| Sesson["SomeObject"] to another session and then finally start this
session.
| The previous one should be eliminated at the same time. If the timeout
| occured then the Session[] should be serialized and stored on the database
| to restore again whenever the client needs that. That's why I need to know
| if it's possible and how if yes to copy data from the previous session to
a
| new one.
|
| Just D.
|
| "Anders Norås" <an**********@objectware.no> wrote in message
| news:%2****************@tk2msftngp13.phx.gbl...
| > Just D. wrote:
| >> Do we have any access to the Session[] object from a different Session?
| >> The idea is to save Session[] of a current user and then if he logs in
| >> again then return the Session back. It's not a problem to store, there
is
| >> only one complicated object in this Session[], but to get it on
| >> SessionStart to make a copy this is a problem.
| > The session configuration element in web.config has a timeout attribute
| > which controls how long a session is considered valid. The session
timeout
| > is a sliding value; on each request the timeout period is set to the
| > current time plus the timeout value.
| > If you need the session to be valid "forever", like session at
Amazon.com
| > or similar, you should use SQL Server Mode. In SQL Server Mode the
session
| > data is kept in the database.
| >
| > For good coverage of session state in ASP.NET read Rob Howards MSDN
| > article on the topic
| >
http://msdn.microsoft.com/library/de...sp12282000.asp
| >
| > ASP.NET 2.0, which is released later this year, has a Profile API. This
| > API lets you define profile data which is automatically persisted for
both
| > authenticated and anonymous users between visits to a web site.
| >
| > Anders Norås
| > http://dotnetjunkies.com/weblog/anoras/
|
|
Nov 19 '05 #6

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

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
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...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.