473,395 Members | 1,554 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,395 software developers and data experts.

Possible to 'recapture' a asp.net session?

I have an ASP.Net 2.0 app that needs to jump out onto another web
server running a java server page website (Apache TomCat 4.1.12) that
I control. I hate that it needs to do this, but we are using some
internet GIS mapping web tool that comes "precanned" with lots of
mapping ability and its pages run on JSP. Theasp.net Session_End event
is quite important to catch as there is a lot of cleanup that needs to
happen in the database relating to the user of that session. Thus, I
need to maintain the session across ASP.Net and JSP webservers. A
hackish way that I accomplished this was to use cookieless sessions
which embeds the session id in the url (e.g.
http://www.abc.com/(S(2zmfutqdfdvm2a...oduction.aspx),
have the jsp side parse out the session id and keep it around while
the user does what they need to do on the jsp pages, and then when it
is time to return to the ASP.Net side just construct a url that has
the cookieless session format with the same session id.

This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need
to capture that session_end event. It would be great if I could just
pass around a sessionid in the query string and create a session with
that specified id, but that doesn't appear to be possible.

Thanks.

May 18 '07 #1
6 1728
You don't need to maintain the Session to ensure that the Session_End event
fires. The Session_End Event will fire as soon as the Session times out on
the server. It is a server-side event that happens without any interaction
with the client. The only part that the client has in terms of Session_End
is keeping the Session alive. The Session is on a timer, and when the timer
elapses, the Session_End event fires. When a Request from the same client
comes back, the timer is reset.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Marcus" <ho**********@hotmail.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
>I have an ASP.Net 2.0 app that needs to jump out onto another web
server running a java server page website (Apache TomCat 4.1.12) that
I control. I hate that it needs to do this, but we are using some
internet GIS mapping web tool that comes "precanned" with lots of
mapping ability and its pages run on JSP. Theasp.net Session_End event
is quite important to catch as there is a lot of cleanup that needs to
happen in the database relating to the user of that session. Thus, I
need to maintain the session across ASP.Net and JSP webservers. A
hackish way that I accomplished this was to use cookieless sessions
which embeds the session id in the url (e.g.
http://www.abc.com/(S(2zmfutqdfdvm2a...oduction.aspx),
have the jsp side parse out the session id and keep it around while
the user does what they need to do on the jsp pages, and then when it
is time to return to the ASP.Net side just construct a url that has
the cookieless session format with the same session id.

This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need
to capture that session_end event. It would be great if I could just
pass around a sessionid in the query string and create a session with
that specified id, but that doesn't appear to be possible.

Thanks.

May 18 '07 #2
On May 18, 6:00 pm, Marcus <holysmoke...@hotmail.comwrote:
This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need
hmm. but what about "normal" cookie-based session?

May 18 '07 #3
Well, the thing is, when I leave the asp.net page and head over to
jsp, I loose the asp.net session. When I come back to the asp.net
page, I want to reestablish that same session so that the session_end
event will be raised only after this reestablished session has timed
out, not after a certain timeout period from when I first left the
asp.net page. There is a lot of user data in the database that both
the asp and jsp sides are accessing. When the session expires, I want
to remove this data. I have the cleanup code in the session_end event,
but if I can't reestablish the session, then the user data will be
removed prematurely.

One approach I might try is to record in the database the last access
time for a particular user for the site (thus for each page load this
would be updated). Then I could create a job in Sql Server that runs
every few minutes that does the data cleanup for the user once a
particular amount of time has passed from the last page access to the
current time.

M.

On May 18, 10:14 am, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
You don't need to maintain the Session to ensure that the Session_End event
fires. The Session_End Event will fire as soon as the Session times out on
the server. It is a server-side event that happens without any interaction
with the client. The only part that the client has in terms of Session_End
is keeping the Session alive. The Session is on a timer, and when the timer
elapses, the Session_End event fires. When a Request from the same client
comes back, the timer is reset.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net

"Marcus" <holysmoke...@hotmail.comwrote in message

news:11**********************@u30g2000hsc.googlegr oups.com...
I have an ASP.Net 2.0 app that needs to jump out onto another web
server running a java server page website (Apache TomCat 4.1.12) that
I control. I hate that it needs to do this, but we are using some
internet GIS mapping web tool that comes "precanned" with lots of
mapping ability and its pages run on JSP. Theasp.net Session_End event
is quite important to catch as there is a lot of cleanup that needs to
happen in the database relating to the user of that session. Thus, I
need to maintain the session across ASP.Net and JSP webservers. A
hackish way that I accomplished this was to use cookieless sessions
which embeds the session id in the url (e.g.
http://www.abc.com/(S(2zmfutqdfdvm2a...oduction.aspx),
have the jsp side parse out the session id and keep it around while
the user does what they need to do on the jsp pages, and then when it
is time to return to the ASP.Net side just construct a url that has
the cookieless session format with the same session id.
This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need
to capture that session_end event. It would be great if I could just
pass around a sessionid in the query string and create a session with
that specified id, but that doesn't appear to be possible.
Thanks.

May 18 '07 #4
I would prefer cookie based sessions, but still how do I re-establish
the session once I return to the asp.net page? It would be great if I
could assign the old session id (which would likely still be active)
to the new session object, but I don't think that is possible.

M.

On May 18, 10:51 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 18, 6:00 pm, Marcus <holysmoke...@hotmail.comwrote:
This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need

hmm. but what about "normal" cookie-based session?

May 18 '07 #5
On May 18, 8:46 pm, Marcus <holysmoke...@hotmail.comwrote:
I would prefer cookie based sessions, but still how do I re-establish
the session once I return to the asp.net page? It would be great if I
could assign the old session id (which would likely still be active)
to the new session object, but I don't think that is possible.
A session will expire when the time specified by the timeout passes
without a request being made for the session. And you can go to
another server and go back and get the session back during the time of
timeout. If you don't know what timeout you will need and to ensure
availability, a session can be extended by request (e.g. by a time
based javascript).

As I understand, the main problem is in the cache of user data in the
database. You shouldn't use the Session_End event to clean it up
(because it does not always fire), you need to make a job in Sql
Server. But here, I guess, will a problem that you don't know if you
can delete the cache or not...

Another approach can be a SQL Server mode session, that stores a
session in a SQL Server database. In this case, I think you can find
the time when the session has been updated.

May 18 '07 #6
That's an idea. A database is about the only thing you can count on. You can
store a unique identifier in the user's Cookies, which can be used to hook
the user back up to their cached data.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Marcus" <ho**********@hotmail.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
Well, the thing is, when I leave the asp.net page and head over to
jsp, I loose the asp.net session. When I come back to the asp.net
page, I want to reestablish that same session so that the session_end
event will be raised only after this reestablished session has timed
out, not after a certain timeout period from when I first left the
asp.net page. There is a lot of user data in the database that both
the asp and jsp sides are accessing. When the session expires, I want
to remove this data. I have the cleanup code in the session_end event,
but if I can't reestablish the session, then the user data will be
removed prematurely.

One approach I might try is to record in the database the last access
time for a particular user for the site (thus for each page load this
would be updated). Then I could create a job in Sql Server that runs
every few minutes that does the data cleanup for the user once a
particular amount of time has passed from the last page access to the
current time.

M.

On May 18, 10:14 am, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
>You don't need to maintain the Session to ensure that the Session_End
event
fires. The Session_End Event will fire as soon as the Session times out
on
the server. It is a server-side event that happens without any
interaction
with the client. The only part that the client has in terms of
Session_End
is keeping the Session alive. The Session is on a timer, and when the
timer
elapses, the Session_End event fires. When a Request from the same client
comes back, the timer is reset.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net

"Marcus" <holysmoke...@hotmail.comwrote in message

news:11**********************@u30g2000hsc.googleg roups.com...
>I have an ASP.Net 2.0 app that needs to jump out onto another web
server running a java server page website (Apache TomCat 4.1.12) that
I control. I hate that it needs to do this, but we are using some
internet GIS mapping web tool that comes "precanned" with lots of
mapping ability and its pages run on JSP. Theasp.net Session_End event
is quite important to catch as there is a lot of cleanup that needs to
happen in the database relating to the user of that session. Thus, I
need to maintain the session across ASP.Net and JSP webservers. A
hackish way that I accomplished this was to use cookieless sessions
which embeds the session id in the url (e.g.
http://www.abc.com/(S(2zmfutqdfdvm2a...oduction.aspx),
have the jsp side parse out the session id and keep it around while
the user does what they need to do on the jsp pages, and then when it
is time to return to the ASP.Net side just construct a url that has
the cookieless session format with the same session id.
This works OK, but cookieless sessions have some limitations (e.g.
must use only relative addressing). Is there any other way that I can
recapture a session when I return to an asp.net page where I formerly
had a session just moments before? This is all required because I need
to capture that session_end event. It would be great if I could just
pass around a sessionid in the query string and create a session with
that specified id, but that doesn't appear to be possible.
Thanks.


May 18 '07 #7

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

Similar topics

9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
2
by: Chris Hayes | last post by:
Is it possible to iterate through all the active sessions of an ASP.net application? I have this fancy user object (with all kinds of properties) that I set as a session level object on session...
4
by: HG | last post by:
Hi gurus Sorry the rather long post... I am facing a real world problem here, and I dunno how to approach it. Don't even know if this is the right group...but since my app is ASP.NET I tried...
5
by: Chris Ochs | last post by:
It doesn't currently seem possible to switch between different users using SET SESSION AUTHORIZATION. If I log in as the superuser and switch to another user that works, but if I then switch to a...
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: 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...
0
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.