Hi,
From your description, you want to manually control the asp.net web page's
loading via a certain class so that to do some operations before loading
the page or in other word, use the class to do some certain operation on
the page object and then let it load, yes?
As for this question, here are my suggestions:
In VB OR .NET Winform application, we can create a form class's instance
and do some intial operations on it and manually show it that'll cause the
Form_load event be fired. This is because it's in the desktop application
which all the instance a all in the certain machine 's memory.
In asp.net (Or other web application), the application is b/s mode
browser/server, the page is finally display as normal html page in
clientside's browser. The serverside page instance only exist when the web
request is being processing at the serverside. The webrequest will pass
serveral progresses in the serverside which is called asp.net "pipeline" ,
here is a tech article on this:
#The ASP.NET HTTP Runtime
http://msdn.microsoft.com/library/en-us/dnaspp/html/dngrfTheASPNETHTTPRuntim
e.asp?frame=true
And the page instance (infact, it should be called as "PageHandler" is be
instanced at the final progress). At that time, the page's serverside life
cycle begins, it has serval events when during the whole procedure, such as
Init,
Load, PreRender, Render..
All these are called by asp.net runtime, not controlable by us. The
following tech refrence in MSDN maybe helpful for understanding this model:
#The ASP.NET Page Object Model
http://msdn.microsoft.com/library/en-us/dnaspp/html/aspnet-pageobjectmodel.a
sp?frame=true
#Web Forms Page Processing
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsPageProcessi
ngStages.asp?frame=true
So I think what we can do is make use of these existing event , for example
the Page_Init or Page_Load event and put our initial processing in these
events. Also, if you want a group of pages which all have some common
precessing before load, you can define a common base page class and hook
the Init event and the other pages will derived from this base page class
so that they'll inherit the processing in the Init event or can Override
it. How do you think of this?
If you have any other ideas or question, please feel free to post
here.Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx