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

Posted on 2005-04-18
Last Modified: 2010-05-02
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
Question by:Nabilbahr
    LVL 38

    Accepted 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.
    LVL 38

    Expert Comment

    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.

    Author Comment

    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
    LVL 38

    Expert Comment

    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 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

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now