locking question

S

szabelin

Do all asp threads servicing requests run as part of same
app domain? I need a lock at the scope of my web-app; is
the code below a correct way to syncronize blocks of code
in asp.net. Will this work if load balancer (multiple
servers) are used? Thanks!

lock(typeof(string))
{}

or

lock(Singleton.Instance)
{}
 
C

Charlie Nilsson [MSFT]

Short answer, no. Your web farm will not sync on sections of code. Using
lock() will work within critical sections of code to assure that
simultaneous page requests (aspnet threads) do not access that block at the
same time.


Charlie Nilsson [msft]
Visual Studio Update

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top