Commerce Starter Kit 学习(3)

来源:互联网 发布:淘宝双十二报名条件 编辑:程序博客网 时间:2024/05/06 19:19

这一节,我们来看一下页面的加载.

这个网站需要用户认证的.其实这个认证是能过Forms验证来实现的,很简单.就是在用户登录或注册成功后,利用FormsAthentication.RedirectFromeLoginPage(customterId,T/F);就行了.简单吧!这样Request.IsAuthenticated就为true了.  可以用Request.IsAuthenticated判断就行了! 

 protected void Page_Init(object sender, EventArgs e) {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
        }

  #region Web Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {   
            this.SubmitBtn.Click += new System.Web.UI.ImageClickEventHandler(this.SubmitBtn_Click);

        }
  #endregion

 public CheckOut() {//页面类构造函数.
            Page.Init += new System.EventHandler(Page_Init);
        }

这就是一个窗体类的初始化的过程.

其实我们一般习惯这样写:private void Page_Load(object sender, System.EventArgs e) 
{ }
override protected void OnInit(EventArgs e)

    InitializeComponent(); 
    
base.OnInit(e);
}

private void InitializeComponent()

     
this.Load += new System.EventHandler(this.Page_Load);
}

 

原创粉丝点击