|
Subject:
|
(SitePrincipal)Context.User
|
|
Posted By:
|
Philey
|
Post Date:
|
7/25/2003 5:40:28 AM
|
Excuse me,
In Chapter 5,Roles¡¢EditRole¡¢RoleAssignments in admin is error.It is about
(SitePrincipal)Context.User.Moreover£¬what mean about"Put user code to initialize the page
here"in the progam(EditRole.aspx.cs)?
I tried to complete thePhile\Modules\admin\roles.aspx ,but received the following message
from Anthecinus C# Editor:
//-------------------------------------------- 1¡¢admin/roles.aspx error£º Stack Trace: System.InvalidCastException: Can't convert type. at
thePhile.Modules.Accounts.Web.Roles.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\thePhile\Modules\Users\Admin\Roles.aspx.cs:line 41 at
System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs
e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain() //-------------------------------------------- 2¡¢admin/Editrole.aspx error£º Stack Trace: System.InvalidCastException: Can't convert type. at
thePhile.WebModules.Web.EditRole.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\thePhile\Modules\Users\Admin\EditRole.aspx.cs:line 59 at
System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs
e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain() //-------------------------------------------- 3¡¢admin/RoleAssignments.aspx error£º Stack Trace: System.IndexOutOfRangeException: Nothing in row 0.at System.Data.DataRowCollection.get_Item(Int32
index) at thePhile.WebModules.Accounts.Data.Role.Retrieve(Int32 roleId) in
C:\Inetpub\wwwroot\thePhile\AccountsData\Role.cs:line 64 at
thePhile.WebModules.Accounts.Business.Role..ctor(Int32 currentRoleId) in
C:\Inetpub\wwwroot\thePhile\AccountsBusiness\Role.cs:line 27 at
thePhile.Modules.Accounts.Web.RoleAssignments.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\thePhile\Modules\Users\Admin\RoleAssignments.aspx.cs:line 43 at
System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs
e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()
It's likely to the class SitePrincipal and class SiteIdentity can not work.
What are some possible solutions that I need to check?
Thank you for your help!!
|
|
Reply By:
|
gantine
|
Reply Date:
|
10/8/2004 7:40:59 AM
|
Hello, excuse for my English. I see that nobody has not answered you. Also I have the same problem I have resolved the problem? I continue to try. If I resolve I make you to know. Soon...
|
|
Reply By:
|
bmains
|
Reply Date:
|
10/8/2004 5:04:56 PM
|
Could you post the code? I don't have the book. It's likely that you are storing a custom SitePrincipal object in the context's User property. However, after the page reloads, it drops that reference. Use another mechanism, such as the Session, to store that reference.
Brian
|
|
Reply By:
|
englere
|
Reply Date:
|
10/8/2004 5:38:09 PM
|
This sounds like the problem that we answer about once every 2 weeks. The order of these 2 lines has to be switched:
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { base.OnInit(e); // THIS LINE MUST COME FIRST !!!! InitializeComponent(); }
Eric
|