To follow up on Cowboy's post.
I have a web singleton at:
http://sholliday.spaces.msn.com/ 10/24/2005 entry.
I am using the Session object, its easily converted to an Application
object.
Here are the changes to make... from the code you can get from the blog:
private static string WEB_APPLICATION _OBJECT_GUID =
"D777D4C2-1576-40C3-88F8-FA16E94DDC90";
private static WebApplicationD ataStore singletonInstan ce = null;
private Hashtable m_memoryStore = null;
private WebApplicationD ataStore()
{
this.m_memorySt ore = new Hashtable();
}
public static WebApplicationD ataStore GetInstance()
{
if (null != System.Web.Http Context.Current )
{
if (null != System.Web.Http Context.Current .Application )
{
if (null !=
System.Web.Http Context.Current .Application[WEB_APPLICATION _OBJECT_GUID] )
{
singletonInstan ce =
((WebApplicatio nDataStore)(Sys tem.Web.HttpCon text.Current.Ap plication.Get(W E
B_APPLICATION_O BJECT_GUID)));
}
}
}
if ((singletonInst ance == null))
{
singletonInstan ce = new WebApplicationD ataStore();
System.Web.Http Context.Current .Application.Ad d(WEB_APPLICATI ON_OBJECT_GUID,
singletonInstan ce);
}
return singletonInstan ce;
}
"Mike" <no**@none.comw rote in message
news:Oo******** ******@TK2MSFTN GP04.phx.gbl...
>
Hello,
I am working on a ASP.NET 1.1 project and would like to set up the web
application to only have one unique Business Logic object that is created
when the client connects. I would like to avoid re-instantiating the
object
every time a page is loaded (the connection to the DB are currently in a
PageBase class). I basically would like to be able to re-use the web
pages,
call "generic" methods on my Business Logic, so that the web application
can
be re-used among other projects that need to display the same information.
In WinForms I would do that in the entry point of the application, but I
am
not really sure how to do it in ASP.NET/
Any suggestion?
Thanks.
Mike