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)
{
base.OnInit(e);
initializeComponent();
}
private void InitializeComponent()
{
this.Submit.Click += new System.EventHandler(this.Submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion"
The code
"
base.OnInit(e);
initializeComponent();
"
was changet to
"
initializeComponent();
base.OnInit(e);
" automatically.
I can't the reason
but after fixing it. There was no problem.
Try it.
|