[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

public declaration of a string value is not available for all web users

i declared a public value,  and from what i understand that any change on its value will apply the new value to all live users of that DLL file , but i tried to open many browser windows to the same page , it sometimes show the new value and sometimes not . i can't understand why the new value does not apply for all users
while it is declared as Public
  • 3
1 Solution
Your web component uses apartment threading.  Now in C++ you would be able to create global variables that would be shared even with apartment threading, but in VB, global variables are global only to the calling thread.  


Ideally you don't want your objects tied to session scope, this will bog down your server. They should be created and unloaded at the page level.
As a workaround, I suggest that you persist your global information on the server.  You can cache a simple string for a short duration in the Application object:

Application("MyString") = "Hello world"

You might consider backing that up with a database record or a text file, as you have little control over when the application object will expire.
NabilbahrAuthor Commented:
i tried to use single threading, but the application has failed.
Can you also tell me what is the disadvantages of single threading, for example do errors on the single thread cause errors to all users on the same thread,
i see theat by default  it is appartment threading
Single threading can result in serious bottlenecks on the server.  You should use Apartment threading and make sure that the "Unattended execution" box is checked.  

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/6d592697-d540-4948-86c3-deaebad5b2f5.asp for more information on threading models and IIS.  However, some threading models are not implemented in VB.

Creating Visual Basic COM Components for ASP

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now