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

x
  • 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
0
Nabilbahr
Asked:
Nabilbahr
  • 3
1 Solution
 
PaulHewsCommented:
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.  

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconapartmentmodelmultithreadinginvisualbasic.asp

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.
0
 
PaulHewsCommented:
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.
0
 
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
0
 
PaulHewsCommented:
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
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/6d592697-d540-4948-86c3-deaebad5b2f5.asp
0

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