473,411 Members | 2,078 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,411 software developers and data experts.

Two Requests acessing the Session collection

Hi,

I have a problem where I have two requests (i.e. two different windows that
are using the same session) that are accessing the session collection. The
requests will need more time on the server, but I get the problem that the
two sessions are not getting updated values from each requests. Is this by
design or is there any solution to do this?

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/
Nov 2 '06 #1
8 1973
Michael,

Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Hi,

I have a problem where I have two requests (i.e. two different windows
that
are using the same session) that are accessing the session collection. The
requests will need more time on the server, but I get the problem that the
two sessions are not getting updated values from each requests. Is this by
design or is there any solution to do this?

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


Nov 2 '06 #2
Hi John,
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:pc******************************@eclipse.net. uk...
Michael,

Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html

hm, but if I have two requests with the same SessionID (Ajax requests) and
with this I cannot sync both sessions.

Example: first request will run for 10 seconds, and the second one will get
the progress. I get it working using SQL Server or static variables (app
wide), but not with the session collection. :(

Michael

>
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
>Hi,

I have a problem where I have two requests (i.e. two different windows
that
are using the same session) that are accessing the session collection.
The
requests will need more time on the server, but I get the problem that
the
two sessions are not getting updated values from each requests. Is this
by
design or is there any solution to do this?

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/



Nov 2 '06 #3
It isn't something as simple as accessing HttpContext.Current.Session in
your ajax server method rather than just session is it and it not being on
context?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ee**************@TK2MSFTNGP04.phx.gbl...
Hi John,
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:pc******************************@eclipse.net. uk...
>Michael,

Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html


hm, but if I have two requests with the same SessionID (Ajax requests) and
with this I cannot sync both sessions.

Example: first request will run for 10 seconds, and the second one will
get the progress. I get it working using SQL Server or static variables
(app wide), but not with the session collection. :(

Michael

>>
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
>>Hi,

I have a problem where I have two requests (i.e. two different windows
that
are using the same session) that are accessing the session collection.
The
requests will need more time on the server, but I get the problem that
the
two sessions are not getting updated values from each requests. Is this
by
design or is there any solution to do this?

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/




Nov 2 '06 #4
The problem is that one requests changed a session variable that will not be
visible to the other request. Is the session collection only be updated when
request is finished?
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:27******************************@eclipse.net. uk...
It isn't something as simple as accessing HttpContext.Current.Session in
your ajax server method rather than just session is it and it not being on
context?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ee**************@TK2MSFTNGP04.phx.gbl...
>Hi John,
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:pc******************************@eclipse.net .uk...
>>Michael,

Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html


hm, but if I have two requests with the same SessionID (Ajax requests)
and with this I cannot sync both sessions.

Example: first request will run for 10 seconds, and the second one will
get the progress. I get it working using SQL Server or static variables
(app wide), but not with the session collection. :(

Michael

>>>
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Hi,

I have a problem where I have two requests (i.e. two different windows
that
are using the same session) that are accessing the session collection.
The
requests will need more time on the server, but I get the problem that
the
two sessions are not getting updated values from each requests. Is this
by
design or is there any solution to do this?

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/




Nov 2 '06 #5
The session data is not stored until ReleaseRequestState is called - at the
end of the request. Your Ajax method should not use session if you want
dynamic session data across calls from the same sesion client as marking the
method with SessionStateRequirement.ReadWrite will block the session access
until the first request completes. Given what your trying to do, your
perhaps better off not using session.

Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz [MVP]" <no****@schwarz-interactive.dewrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
The problem is that one requests changed a session variable that will not
be visible to the other request. Is the session collection only be updated
when request is finished?
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:27******************************@eclipse.net. uk...
>It isn't something as simple as accessing HttpContext.Current.Session in
your ajax server method rather than just session is it and it not being
on context?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ee**************@TK2MSFTNGP04.phx.gbl...
>>Hi John,
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:pc******************************@eclipse.ne t.uk...
Michael,

Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html
hm, but if I have two requests with the same SessionID (Ajax requests)
and with this I cannot sync both sessions.

Example: first request will run for 10 seconds, and the second one will
get the progress. I get it working using SQL Server or static variables
(app wide), but not with the session collection. :(

Michael

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Hi,
>
I have a problem where I have two requests (i.e. two different windows
that
are using the same session) that are accessing the session collection.
The
requests will need more time on the server, but I get the problem that
the
two sessions are not getting updated values from each requests. Is
this by
design or is there any solution to do this?
>
--
Best regards | Schöne Grüße
Michael
>
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
>
http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/
>
>




Nov 2 '06 #6
That means that it is not possible to use Session state information in two
concurrent requests until ReleaseRequestState is called. What do you
recommend to use to communicate between two concurrent calls? Application is
not the correct context.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:Co********************@eclipse.net.uk...
The session data is not stored until ReleaseRequestState is called - at
the end of the request. Your Ajax method should not use session if you
want dynamic session data across calls from the same sesion client as
marking the method with SessionStateRequirement.ReadWrite will block the
session access until the first request completes. Given what your trying
to do, your perhaps better off not using session.

Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz [MVP]" <no****@schwarz-interactive.dewrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>The problem is that one requests changed a session variable that will not
be visible to the other request. Is the session collection only be
updated when request is finished?
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:27******************************@eclipse.net .uk...
>>It isn't something as simple as accessing HttpContext.Current.Session in
your ajax server method rather than just session is it and it not being
on context?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ee**************@TK2MSFTNGP04.phx.gbl...
Hi John,
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im
Newsbeitrag news:pc******************************@eclipse.net. uk...
Michael,
>
Take a quick look at this thread.
http://www.velocityreviews.com/forum...net-pages.html
hm, but if I have two requests with the same SessionID (Ajax requests)
and with this I cannot sync both sessions.

Example: first request will run for 10 seconds, and the second one will
get the progress. I get it working using SQL Server or static variables
(app wide), but not with the session collection. :(

Michael


>
--
Regards
>
John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
>
>
>
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl.. .
>Hi,
>>
>I have a problem where I have two requests (i.e. two different
>windows that
>are using the same session) that are accessing the session
>collection. The
>requests will need more time on the server, but I get the problem
>that the
>two sessions are not getting updated values from each requests. Is
>this by
>design or is there any solution to do this?
>>
>--
>Best regards | Schöne Grüße
>Michael
>>
>Microsoft MVP - Most Valuable Professional
>Microsoft MCAD - Certified Application Developer
>>
>http://weblogs.asp.net/mschwarz/
>http://www.ajaxpro.info/
>>
>>
>
>




Nov 13 '06 #7
I'm not sure Micheal, it seems your problem is only connected to having two
requests trying to access the same session data asynch - not that you can't
access the session data at all? Is that correct?

I've not actually come across the problem but i it was me, I'd stick the
values in the database or investigate the cache object perhaps.

You could always try calling ReleaseRequestState from your second call to
force termination of the session lock and update session - not sure if it
would work though, or what any side effects might be throuigh Ajax.

Why dont you ask Scott Guthrie for a recomendation - you would guess he must
have come across this already?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz [MVP]" <no****@schwarz-interactive.dewrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
That means that it is not possible to use Session state information in two
concurrent requests until ReleaseRequestState is called. What do you
recommend to use to communicate between two concurrent calls? Application
is not the correct context.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:Co********************@eclipse.net.uk...
>The session data is not stored until ReleaseRequestState is called - at
the end of the request. Your Ajax method should not use session if you
want dynamic session data across calls from the same sesion client as
marking the method with SessionStateRequirement.ReadWrite will block the
session access until the first request completes. Given what your trying
to do, your perhaps better off not using session.

Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz [MVP]" <no****@schwarz-interactive.dewrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>The problem is that one requests changed a session variable that will
not be visible to the other request. Is the session collection only be
updated when request is finished?
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im Newsbeitrag
news:27******************************@eclipse.ne t.uk...
It isn't something as simple as accessing HttpContext.Current.Session
in your ajax server method rather than just session is it and it not
being on context?

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ee**************@TK2MSFTNGP04.phx.gbl...
Hi John,
>
>
"John Timney (MVP)" <x_****@timney.eclipse.co.ukschrieb im
Newsbeitrag news:pc******************************@eclipse.net. uk...
>Michael,
>>
>Take a quick look at this thread.
>http://www.velocityreviews.com/forum...net-pages.html
>
>
hm, but if I have two requests with the same SessionID (Ajax requests)
and with this I cannot sync both sessions.
>
Example: first request will run for 10 seconds, and the second one
will get the progress. I get it working using SQL Server or static
variables (app wide), but not with the session collection. :(
>
Michael
>
>
>
>
>>
>--
>Regards
>>
>John Timney (MVP)
>VISIT MY WEBSITE:
>http://www.johntimney.com
>http://www.johntimney.com/blog
>>
>>
>>
>"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
>news:Om**************@TK2MSFTNGP04.phx.gbl. ..
>>Hi,
>>>
>>I have a problem where I have two requests (i.e. two different
>>windows that
>>are using the same session) that are accessing the session
>>collection. The
>>requests will need more time on the server, but I get the problem
>>that the
>>two sessions are not getting updated values from each requests. Is
>>this by
>>design or is there any solution to do this?
>>>
>>--
>>Best regards | Schöne Grüße
>>Michael
>>>
>>Microsoft MVP - Most Valuable Professional
>>Microsoft MCAD - Certified Application Developer
>>>
>>http://weblogs.asp.net/mschwarz/
>>http://www.ajaxpro.info/
>>>
>>>
>>
>>
>
>




Nov 13 '06 #8
You can maybe override ReleaseRequestState and associated methods
with your own version.
Say, try using thread wait, notify with delegate callbacks to update
your concurrent requirements.
Would be interesting and possibly useful piece of code for all
of us.

also when the ReleaseRequestState event is raised, the application is
finished with the request and ASP.NET is signaled to store the request
state.

wawens

Nov 14 '06 #9

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...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
5
by: PJ | last post by:
I posted a few days ago concerning requests being blocked from a main window after a popup window had initiated a file download. Apparently this has to do with the fact that asp.net or iis...
3
by: Don | last post by:
I have an ASP.NET program that references a VB.NET DLL. I had originally planned for my DLL to put things in the HttpContext.Current collection so that the ASP.NET can access them throughout an...
8
by: Pietro | last post by:
Hi, i would like to know if there is a way to differentiate between requests, someting like a number that is unique only in the execution of an individual request. Thank you Pietro
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...
7
by: bonk | last post by:
Hello I am acessing a Dictionary<TKey,TValuefrom multiple threads and often in a foreach loop. While I am within one of the foreach loops the other threads must not modify the collection itself...
3
by: dihola | last post by:
Hi, I have a website running in IIS7 and it seems to be creating a new session for every request I make. The values I store in Session are lost with every request. This is the forms bit in my...
7
by: =?Utf-8?B?Vkg=?= | last post by:
Hi, all. Need help with what seems to be either connection, or threading problem in my ASP.NET 2.0 application. The gist of the problem is this: IHttpHandler in my application serves an HTML...
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
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...
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
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...

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.