How to create singleton Page in asp.net
We can use a class implement IHttpHandlerFactory to override or intercept the create progress of Page's instance
In a word we can use: PageHandlerFactory factory = (PageHandlerFactory)Activator.CreateInstance(typeof(PageHandlerFactory), true); IHttpHandler handler = factory.GetHandler(context, requestType, url, pathTranslated); return handler; to create new instance of asp.net page object. But you know, the page is not in persistence If you save the object in applicationstate or session, when next request, you can get the pag开发者_开发知识库e,but you will find the Application(HttpApplication) in "Page.Context" is null. In that, the page visit will fail and it cannot be a singleton one. How to set the httpApplication?I don't understand all of your question, but I guess you are looking for HttpContext.Current.Application
Use that instead of Page.Context.Application
.
I think that you need to call the internal protected FrameworkInitialize() function after the page has been constructed.
精彩评论