Hi, I´ve been following the book step by step. The code downloaded for
the book works great but my code used for accounts management keeps
running into invalid casts concerning the siteprincipal class and
Context.User. Anyones else run into this problem. My base.OnInit is
already executing first. Sample code follows:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SitePrincipal currentPrincipal = (SitePrincipal)
Context.User; //******* <--lid Cast Here ***************
if (!currentPrincipal.HasPermission((int)
Syrtec.Lib.Config.AccountsPermissions.CreateRoles))
{
NewRoleButton.Visible = false;
NewRoleDescription.Visible = false;
}
else
{
NewRoleButton.Visible = true;
NewRoleDescription.Visible = true;
}
roles = Syrtec.Lib.Auth.Biz.Tools.GetRoleList();
RoleList.DataSource = roles.Tables["Roles"];
RoleList.DataBind();
}
Thanks.