views:

25

answers:

1

Do vb.net static variables work on an IIS web garden?

+2  A: 

That depends on what you plan to use them for.

You have one set of static variables per process, so if you plan to use it for sharing data between servers, that won't work.

If you plan to use it for caching, it will work. All threads on the same server will share the cache, but you will have one cache per server.

Guffa
Not sure why I stated vb.net since language does not matter. Let me give you some further detail. Our company is considering using the NoBot control which is part of the Ajax Control Toolkit. Looking at the NoBot.cs source file one of the features tracks the ip addresses in a static variable as shown below. I do not know if if this variable would work in web garden setup. private static SortedList<DateTime, string> _pastAddresses = new SortedList<DateTime, string>();