c# - Isn't possible to create an instance of Page Class? -


simple webform.aspx class:

namespace _webapplication {      public partial class webform1 : system.web.ui.page      {       }       public class testclass : system.web.ui.page      {          webform1 webform1 = new webform1();       } } 

inside testclass or other class, looks lets me create instance doesn't let me use it. code above doesn't give compile time error. but, if type webform1, says field used type. asking question cos wondering.

when merely derives page class, not meaningful & useful because page content , state is depends on client http request/post information sent server. page instance initialized in number of steps page life-cycle represents perfectly.

if you'll take @ page class, able see contains properties , events related current client's request/page life-cycle, example:

  • request gets httprequest object requested page.

  • session gets current session object provided asp.net

  • user gets information user making page request

look @ following flow diagram , notice how necessary page "built" through life-cycle process in order completion of object/page:

enter image description here


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -