Can one client call a public property within a VB.NET module and see the value of that public property changed by another client accessing it at the same time?
Example:
Client 1 calls
Public Module DataModule
Private theDateTime As DateTime = GetAdjustedDateTime() //initial TZ value
Public Property GetSetDateTime() As DateTime
Get
Return theDateTime
End Get
Set(ByVal value As String)
theDateTime = value
End Set
End Property
End Module
by first setting the Property and then getting the value throughout WhateverMethod()…
Partial Class admintours
Inherits System.Web.UI.Page
Private Sub WhateverMethod()
GetSetDateTime = Now
...
...
... //code
...
SomeFunction(GetSetDateTime) //value is 10/14/2010 00:23:56
...
...
//almost simultaneously Client 2 sets the value to Now.AddDays(-1)
...
SomeOtherFunc(GetSetDateTime) //value passed in: 10/13/2010 00:23:56
...
...
... //some more code
...
End Sub
End Class
I’m running into random instances where it looks like another client might be modifying (by setting) the value of GetSetDateTime DURING the first client’s run through of WhateverMethod(). This is alarming to me and I’ve been trying to figure out if that’s a possibility. Any confirmation or otherwise as to that would be helpful, thanks!
Modules in VB.Net are shared within an
AppDomain. So two clients within the sameAppDomainwill be operating on the same instance of any given Module. This means one could easily see the results of the other writing to the Module if they are running in parallel in the sameAppDomainIn many ways it’s best to view the data stored in a Module as global (it’s not truly global but behaves that way for many samples).