p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

aspdotnet_website_programming thread: SitePrincipal Invalid Casts

Message #1 by "Manolo Alvarez" <manoloalvarez@h...> on Tue, 18 Mar 2003 16:09:51
Hi, Ive 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)
				NewRoleButton.Visible = false;
				NewRoleDescription.Visible = false;
				NewRoleButton.Visible = true;
				NewRoleDescription.Visible = true;
			roles = Syrtec.Lib.Auth.Biz.Tools.GetRoleList();
			RoleList.DataSource = roles.Tables["Roles"];


  Return to Index