Static in Asp.net
-
When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.
:beer:
-
When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.
:beer:
Yes, that is what static means. You have one server, one application instance, and static variables will be shared across it.
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.
-
When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.
:beer: