Principal must be of type BusinessPrincipal, not System.Security.Principal.GenericPrincipal

Principal must be of type BusinessPrincipal, not System.Security.Principal.GenericPrincipal

Old forum URL: forums.lhotka.net/forums/t/4263.aspx


getsetgo_007 posted on Thursday, January 31, 2008

We are currently in process of converting our .Net 1.1 and CSLA 1.0 application to new platform i.e. .Net 3.5 and CSLA 3.0. We are almost through with our Business Objects and starting with Data Portal. We are facing a security exception while trying to fetch data. Exact exception is :

"Csla.DataPortalException: DataPortal.Fetch failed () ---> System.Security.SecurityException: Principal must be of type BusinessPrincipal, not System.Security.Principal.GenericPrincipal

   at Csla.Server.DataPortal.SetContext(DataPortalContext context)

   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)

The action that failed was:

Deny

The Zone of the assembly that failed was:

MyComputer

   --- End of inner exception stack trace ---

   at Csla.Server.DataPortal.SetContext(DataPortalContext context)

   at Csla.Server.DataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)

   at Csla.DataPortal.Fetch(Type objectType, Object criteria)

   at Csla.DataPortal.Fetch(Object criteria)

   at WatchCaptain.BusinessObjects.Utilities.Note.GetNote(Guid note_guid) in D:\WORK\Projects\TestBO\TestBusinessObjects\Utilities\Note.vb:line 167"

I am using Windows Vista home premium and running this remote portal on IIS 7.0. I tried searching this forum for answers but nothing solved the problem. 

Do let me know if there is something that I have to look into my config files. I have used same config entries as provided with Project Tracker project. I have also attached a zip file with my app and web configuration file.

Thanks
Gaurav Sharma
Blog: http://fun-with-blackhawk.blogspot.com
IM
: getsetgo_007@yahoo.com  | Skype: getsetgo_007
Tel (India): +91. 120. 4089942 | Mob: +91.98180-84763

gaurav.sharma@servitium.com | www.servitium.com

ajj3085 replied on Thursday, January 31, 2008

In Csla 2 and higher, you MUST create a subclass of BusinessPrincipal to use Csla authentication.  So, a bit more than an config file change, but not terribly difficult either.

getsetgo_007 replied on Thursday, January 31, 2008

Let me try BusinessPrinciple class. I'll post my findings.

Thanks,
Gaurav

 

 

getsetgo_007 replied on Friday, February 01, 2008

Nevermind, I used Windows authentication instead of Csla authentication.

Thanks,
Gaurav

 

MikeHamilton replied on Tuesday, April 08, 2008

I am getting this error while trying to call the .Login(username, password) on the custom principal object.

I have the code for the Principal and Identity objects as shown in the ebook and it is set to inherit correctly.

This code works when using a local dataproxy but then when switching to calling a Web Service data portal I get this error.

ANY help would be great! I have already been taking too long on this project due to other non CSLA issues. we gave up and it was working and then tried to switch ot using the WS portal and my boss is getting un happy with me again.

Thanks!

Mike

MikeHamilton replied on Tuesday, April 08, 2008

I got this working. I called .Logout the line before the .Login line andthat solved it.

Mike

 

Copyright (c) Marimer LLC