WorkAround:
I have declared a class level Public static variable and initialized with a value 0 in the environment of ASP.NET 3.5 In load event I Incremented by 1 of that variable
Problem:
Postback
, I am getting latest values of that variable.
A variable declared as STATIC
, not getting reset by Page refresh and Postback
?Could you please help on this.
Static variables are valid for the entire AppDomain. When you close your browser you don't close the application as it continues to execute on the web server. Oh and forgot to mention: try to avoid using static variables in multi-threaded applications without proper locking mechanisms or you may run into race conditions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With