Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 25th, 2003, 05:40 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default (SitePrincipal)Context.User

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(Obje ct sender, EventArgs e) in

C:\Inetpub\wwwroot\thePhile\Modules\Users\Admin\Ro les.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\Ed itRole.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(In t32 roleId) in

C:\Inetpub\wwwroot\thePhile\AccountsData\Role.cs:l ine 64 at

thePhile.WebModules.Accounts.Business.Role..ctor(I nt32 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\Ro leAssignments.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 With Quote
  #2 (permalink)  
Old October 8th, 2004, 07:40 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 With Quote
  #3 (permalink)  
Old October 8th, 2004, 05:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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 With Quote
  #4 (permalink)  
Old October 8th, 2004, 05:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
error :(SitePrincipal)Context.User yonghoo BOOK: ASP.NET Website Programming Problem-Design-Solution 5 August 5th, 2004 07:30 AM
Please Help with Context.User Issue niketu BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 28th, 2004 08:29 PM
Context User davidroth BOOK: ASP.NET Website Programming Problem-Design-Solution 0 April 14th, 2004 12:49 AM



All times are GMT -4. The time now is 02:04 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.