[原]控件视图状态分析之 - 用户控件静态加载

以下为名称为default.aspx页面上放一个button, 一个UserControl后IIS自动生成的代码:

[CompilerGlobalScope]
public class default_aspx : _Default, IRequiresSessionState, IHttpHandler
{
    
// Fields
    private static object __fileDependencies;
    
private static bool __initialized;

    
// Methods
    [DebuggerNonUserCode]
    
public default_aspx()
    {
        
base.AppRelativeVirtualPath = "~/Default.aspx";
        
if (!__initialized)
        {
            
string[] dependencies = new string[] { "~/Default.aspx""~/UC.ascx" };
            __fileDependencies 
= base.GetWrappedFileDependencies(dependencies);
            __initialized 
= true;
        }
        
base.Server.ScriptTimeout = 0x1c9c380;
    }

    [DebuggerNonUserCode]
    
private HtmlHead __BuildControl__control2()
    {
        HtmlHead __ctrl 
= new HtmlHead("head");
        HtmlTitle __ctrl1 
= this.__BuildControl__control3();
        IParserAccessor __parser 
= __ctrl;
        __parser.AddParsedSubObject(__ctrl1);
        
return __ctrl;
    }

    [DebuggerNonUserCode]
    
private HtmlTitle __BuildControl__control3()
    {
        HtmlTitle __ctrl 
= new HtmlTitle();
        IParserAccessor __parser 
= __ctrl;
        __parser.AddParsedSubObject(
new LiteralControl("无标题页"));
        
return __ctrl;
    }

    [DebuggerNonUserCode]
    
private Button __BuildControlbtnTest()
    {
        Button __ctrl 
= new Button();
        
base.btnTest = __ctrl;
        __ctrl.ApplyStyleSheetSkin(
this);
        __ctrl.ID 
= "btnTest";
        __ctrl.Text 
= "testButton";
        
return __ctrl;
    }

    [DebuggerNonUserCode]
    
private HtmlForm __BuildControlform1()
    {
        HtmlForm __ctrl 
= new HtmlForm();
        
base.form1 = __ctrl;
        __ctrl.ID 
= "form1";
        IParserAccessor __parser 
= __ctrl;
        __parser.AddParsedSubObject(
new LiteralControl("\r\n    <div>\r\n        "));
        Button __ctrl1 
= this.__BuildControlbtnTest();
        __parser.AddParsedSubObject(__ctrl1);
        __parser.AddParsedSubObject(
new LiteralControl("\r\n        "));
        uc_ascx __ctrl2 
= this.__BuildControlUC1();
        __parser.AddParsedSubObject(__ctrl2);
        __parser.AddParsedSubObject(
new LiteralControl("\r\n    </div>\r\n    "));
        
return __ctrl;
    }

    [DebuggerNonUserCode]
    
private void __BuildControlTree(default_aspx __ctrl)
    {
        
this.InitializeCulture();
        IParserAccessor __parser 
= __ctrl;
        __parser.AddParsedSubObject(
new LiteralControl("\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n"));
        HtmlHead __ctrl1 = this.__BuildControl__control2();
        __parser.AddParsedSubObject(__ctrl1);
        __parser.AddParsedSubObject(
new LiteralControl("\r\n<body>\r\n    "));
        HtmlForm __ctrl2 
= this.__BuildControlform1();
        __parser.AddParsedSubObject(__ctrl2);
        __parser.AddParsedSubObject(
new LiteralControl("\r\n</body>\r\n</html>\r\n"));
    }

    [DebuggerNonUserCode]
    
private uc_ascx __BuildControlUC1()
    {
        uc_ascx __ctrl 
= new uc_ascx();
        
base.UC1 = __ctrl;
        __ctrl.InitializeAsUserControl(
this.Page);
        __ctrl.ID 
= "UC1";
        
return __ctrl;
    }

    [DebuggerNonUserCode]
    
protected override void FrameworkInitialize()
    {
        
base.FrameworkInitialize();
        
this.__BuildControlTree(this);
        
base.AddWrappedFileDependencies(__fileDependencies);
        
base.Request.ValidateInput();
    }

    [DebuggerNonUserCode]
    
public override int GetTypeHashCode()
    {
        
return 0x7b97a9fc;
    }

    [DebuggerNonUserCode]
    
public override void ProcessRequest(HttpContext context)
    {
        
base.ProcessRequest(context);
    }

    
// Properties
    protected HttpApplication ApplicationInstance
    {
        
get
        {
            
return this.Context.ApplicationInstance;
        }
    }

    
protected DefaultProfile Profile
    {
        
get
        {
            
return (DefaultProfile) this.Context.Profile;
        }
    }
}

 
Collapse Methods
 
posted @ 2009-04-03 16:24  DukeCheng  阅读(413)  评论(1编辑  收藏  举报