When accessing, for example, an object stored in the session such as:
Session[ "MyObject" ].MyProperty = "Some Value";
Is access to MyObject thread-safe? 4 2893
Hi Chris:
Here are some details:
ASP.NET does manage access to session state with a ReaderWriterLoc k.
The default is to take a writer lock, which serializes requests coming
in on the same session (using EnableSessionSt ate="ReadOnly" takes a
reader lock and does allow concurrent request processing on a
session).
In this example, you are not really modifying session state, but
modifying an object through a reference stored in session state. If
anyone else has a reference to the same object the code is only thread
safe if MyObject is thread safe.
Know what I mean?
--
Scott http://www.OdeToCode.com/blogs/scott/
On Sun, 27 Mar 2005 19:59:26 -0500, "Chris Newby"
<CA************ *****@hotmail.c om> wrote: When accessing, for example, an object stored in the session such as:
Session[ "MyObject" ].MyProperty = "Some Value";
Is access to MyObject thread-safe?
Yeah, makes perfect sense.
Could you possibly elaborate a little more on exactly when ASP.NET creates
and releases the ReaderWriter Lock?
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message
news:om******** *************** *********@4ax.c om... Hi Chris:
Here are some details:
ASP.NET does manage access to session state with a ReaderWriterLoc k. The default is to take a writer lock, which serializes requests coming in on the same session (using EnableSessionSt ate="ReadOnly" takes a reader lock and does allow concurrent request processing on a session).
In this example, you are not really modifying session state, but modifying an object through a reference stored in session state. If anyone else has a reference to the same object the code is only thread safe if MyObject is thread safe.
Know what I mean?
-- Scott http://www.OdeToCode.com/blogs/scott/
On Sun, 27 Mar 2005 19:59:26 -0500, "Chris Newby" <CA************ *****@hotmail.c om> wrote:
When accessing, for example, an object stored in the session such as:
Session[ "MyObject" ].MyProperty = "Some Value";
Is access to MyObject thread-safe?
When the SessionStateMod ule catches the AcquireRequestS tate event
during request processing. This happens before control reaches the
ASPX page handler.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Sun, 27 Mar 2005 21:15:12 -0500, "Chris Newby"
<CA************ *****@hotmail.c om> wrote: Yeah, makes perfect sense.
Could you possibly elaborate a little more on exactly when ASP.NET creates and releases the ReaderWriter Lock?
Thanks Scott, very helpful//
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message
news:48******** *************** *********@4ax.c om... When the SessionStateMod ule catches the AcquireRequestS tate event during request processing. This happens before control reaches the ASPX page handler.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Sun, 27 Mar 2005 21:15:12 -0500, "Chris Newby" <CA************ *****@hotmail.c om> wrote:
Yeah, makes perfect sense.
Could you possibly elaborate a little more on exactly when ASP.NET
createsand releases the ReaderWriter Lock?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew Chanter |
last post by:
I have a VB app that has a routine that runs macros in a (password
protected) Access 97 db. (I have attached the code below.) Most of these
macros end up opening a form in the Access db for the user to interract
with.When the user finishes in the Access session they quit and are returned
to the VB app. Problem is that in many cases, when the user quits the
Access session, an Access 'shell' remains in the taskbar that cannot be
removed...
|
by: dht |
last post by:
I want to use an Access web form for people to submit data on the company
intranet.
I currently have one table ("New PRoducts") that I am using for new products
and once that person has submitted the data and exited it is transfered to
another table.
I'm thinking that if there are lots of people using the "new product" table
will start to show those Items that other people have started putting in?
|
by: Ilia |
last post by:
Hi folks,
I have some problems with ASP.NET Session State. The
following simple program runs well if the Session State
set as "InProc". If I switch to "SQLServer", the changes,
made by the second thread, are lost. Any idea?
I use VS.NET 2003 on Windows Server 2003 with hot fixes
(as of 30-Oct-2003) and SQL Server 2000 SP 3a.
|
by: Al Cohen |
last post by:
We've got a few methods that take a long time to complete. We're in the
process of starting to launch these as separate threads, and having the
web form refresh every few seconds to report the method's progress.
Communication between "new" thread and web page is via the Session
object. (Not rocket science so far.)
The first problem that we ran into was that our methods could not see
the Session object anymore once they were placed in a...
|
by: Christopher |
last post by:
In one of our ASP.NET Pages, we are starting a new background thread that we
do not need to go and get any status on or use after the page finishes. The
thread merely does some background stuff on its own and finishes on its own,
no feedback back to the user (by design). Within that thread however, some
items need to be accessed and/or inserted into the Cache for possible
subsequent processing by another page. Many examples I see of...
| |
by: Gavin Lyons via .NET 247 |
last post by:
Hello,
I'm writing a newsletter application which uses backgroundthreading. I'm using Session variable to report on progresswhile it loops through a dataset. The 'Status.aspx' pagerefreshes every 5 seconds while outputing the Session variables.My problem is, once the page redirects to 'Status.aspx' its showthe that's it only gets half through the dataset. If I increaseThread.Sleep to 2000 goes all the way through. I don't get anyerror...
|
by: wekrato |
last post by:
Hi!
I want to do a comfortable way of importing a file into my system via a
webpage.
When importing, the following three components run at the same time:
- ImportStatus which shows how far the import progress has completed so
far and offers the possibility to upload a file
- FetchImport in a second invisible frame which is loaded every few
seconds and retrieves data from the import process (percentage, error
messages,...) from the...
|
by: Åženol Akbulak |
last post by:
Hello;
I use in my web application FormsAuthentication. Also I use Session state
(InProc).
When a user logged in, I can read Session parameters. (For example
Session). Problem is that, when user close the browser window then
open a new browser, FormsAuthentication reads from cookie and user logs in.
Althought user logged in, session parameter is null.
|
by: Dmitry Bogdanov |
last post by:
I have a problem - if I access the session in Web Service, as soon as I
store
anything in it, requests are no longer running in parallel - instead,
they are
queued and executed sequentially. Here is an example (ASP.NET 2.0, VS
2005).
Web service method (web service is a regular asmx):
|
by: Nick Gilbert |
last post by:
Hi,
Is it possible to access the Session of an arbitary user from an aspx page?
On an e-commerce site, I am notified of payment success via a callback
from the payment server to an ASPX page on my system. I would like to be
able to access the session of the user that submitted the order, and
clear their basket. I don't really want to store their session in the
database just to facilitate this.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |