In my case, ther was 2 problems.
Case 1 :
When starting "myaccount.aspx" without login.aspx
there was no time to set
"Context.User = (PhilePrincipal)newUser"
that make the casting problem
Case 2 :
When copy the source code to the new file(Login.aspx of new project)
In the part of
"#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
private void InitializeComponent()
this.Submit.Click += new System.EventHandler(this.Submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
was changet to
I can't the reason
but after fixing it. There was no problem.