M
mark.norgate
Hello
I'm writing an application in ASP.NET 1.1 and have come across a
problem using static fields in my page classes.
I have lots of controls on the page that all need to bind to the same
datasource, so I thought I'd create a singleton in the base class that
reads from the database and provides a DatasSet to all instances of the
various derived classes. I've discovered, though, that the static
values persist between roundtrips, presumably because the singleton
instance hasn't been released by the garbage collector. For this
reason, I've decided that using static in my ASP.NET pages is probably
unsuitable.
Does anyone have any recommendations for using static members in
ASP.NET, or is there a more appropriate method for implementing
singletons in ASP.NET?
Thanks a lot, Mark
I'm writing an application in ASP.NET 1.1 and have come across a
problem using static fields in my page classes.
I have lots of controls on the page that all need to bind to the same
datasource, so I thought I'd create a singleton in the base class that
reads from the database and provides a DatasSet to all instances of the
various derived classes. I've discovered, though, that the static
values persist between roundtrips, presumably because the singleton
instance hasn't been released by the garbage collector. For this
reason, I've decided that using static in my ASP.NET pages is probably
unsuitable.
Does anyone have any recommendations for using static members in
ASP.NET, or is there a more appropriate method for implementing
singletons in ASP.NET?
Thanks a lot, Mark