473,839 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2011
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****@schwa rz-interactive.dew rote in message
news:Om******** ******@TK2MSFTN GP04.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.uksc hrieb 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****@schwa rz-interactive.dew rote in message
news:Om******** ******@TK2MSFTN GP04.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.Cur rent.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****@schwa rz-interactive.dew rote in message
news:ee******** ******@TK2MSFTN GP04.phx.gbl...
Hi John,
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hrieb 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****@schwa rz-interactive.dew rote in message
news:Om******* *******@TK2MSFT NGP04.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.uksc hrieb im Newsbeitrag
news:27******** *************** *******@eclipse .net.uk...
It isn't something as simple as accessing HttpContext.Cur rent.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****@schwa rz-interactive.dew rote in message
news:ee******** ******@TK2MSFTN GP04.phx.gbl...
>Hi John,
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hrieb im Newsbeitrag
news:pc******* *************** ********@eclips e.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****@schwa rz-interactive.dew rote in message
news:Om****** ********@TK2MSF TNGP04.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 ReleaseRequestS tate 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 SessionStateReq uirement.ReadWr ite 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****@schwa rz-interactive.dew rote in message
news:%2******** ********@TK2MSF TNGP02.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.uksc hrieb im Newsbeitrag
news:27******** *************** *******@eclipse .net.uk...
>It isn't something as simple as accessing HttpContext.Cur rent.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****@schwa rz-interactive.dew rote in message
news:ee******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Hi John,
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hrieb im Newsbeitrag
news:pc****** *************** *********@eclip se.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****@schwa rz-interactive.dew rote in message
news:Om***** *********@TK2MS FTNGP04.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 ReleaseRequestS tate 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.uksc hrieb im Newsbeitrag
news:Co******** ************@ec lipse.net.uk...
The session data is not stored until ReleaseRequestS tate 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 SessionStateReq uirement.ReadWr ite 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****@schwa rz-interactive.dew rote in message
news:%2******** ********@TK2MSF TNGP02.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.uksc hrieb im Newsbeitrag
news:27******* *************** ********@eclips e.net.uk...
>>It isn't something as simple as accessing HttpContext.Cur rent.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****@schwa rz-interactive.dew rote in message
news:ee****** ********@TK2MSF TNGP04.phx.gbl. ..
Hi John,
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hrieb im
Newsbeitra g 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****@schwa rz-interactive.dew rote in message
news:Om**** **********@TK2M SFTNGP04.phx.gb l...
>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
>>
>Microsof t MVP - Most Valuable Professional
>Microsof t 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 ReleaseRequestS tate 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****@schwa rz-interactive.dew rote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
That means that it is not possible to use Session state information in two
concurrent requests until ReleaseRequestS tate 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.uksc hrieb im Newsbeitrag
news:Co******** ************@ec lipse.net.uk...
>The session data is not stored until ReleaseRequestS tate 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 SessionStateReq uirement.ReadWr ite 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****@schwa rz-interactive.dew rote in message
news:%2******* *********@TK2MS FTNGP02.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.uksc hrieb im Newsbeitrag
news:27****** *************** *********@eclip se.net.uk...
It isn't something as simple as accessing HttpContext.Cur rent.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****@schwa rz-interactive.dew rote in message
news:ee***** *********@TK2MS FTNGP04.phx.gbl ...
Hi John,
>
>
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hrieb im
Newsbeitr ag 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****@schwa rz-interactive.dew rote in message
>news:Om*** ***********@TK2 MSFTNGP04.phx.g bl...
>>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
>>collectio n. The
>>request s 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
>>>
>>Microso ft MVP - Most Valuable Professional
>>Microso ft MCAD - Certified Application Developer
>>>
>>http://weblogs.asp.net/mschwarz/
>>http://www.ajaxpro.info/
>>>
>>>
>>
>>
>
>




Nov 13 '06 #8
You can maybe override ReleaseRequestS tate 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 ReleaseRequestS tate 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
3313
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 and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and everything is ok. As soon as I try MS IE 6, it doesn't seem to keep the sessions from page to...
11
4984
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., http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=Tidy7IDbDHA.2108%40cpmsftngxa06.phx.gbl) that indicate that ASP will queue up requests when they come in with the same "session".
5
6336
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 serialize all requests from the same session. Further requests from the same session are being queued until the download is complete. So, is there any way to override this? Is there anyway to tell asp.net to not serialize same session requests? Is...
3
1347
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 entire session (according to a tip I saw on a website somewhere), but it turns out that it only lasts for the current page request. If another page is requested, the contents of HttpContext.Current are cleared. Except for the lack of proper scope,...
8
1291
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
3244
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 documentation it seems it should do it anyway any advice?
7
6145
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 since that would cause an exception in the foreach loop "foreach can not continue because the colelction was modifed". Now what is the least expensive and threadsafe way to make sure that no other threads modifies that collection. Since one of the...
3
5010
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 web.config: <authentication mode="Forms"> <forms name=".ReMaCRM" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx" cookieless="AutoDetect" domain="" timeout="10" protection="All" /> </authentication>
7
3166
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 page that has two images (image A and image B) in it. Once the HTML page is served, expected behavior is this: 1) receive request for image A, 2) receive request for image B almost at the same time as for A,
0
9698
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10910
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10589
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10297
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9426
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7021
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5683
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4066
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.