DataPortal.Fetch failed

DataPortal.Fetch failed

Old forum URL:

tesicg posted on Friday, August 26, 2011


We have Silverlight application that uses Csla. We should load test WCF service that Silverlight application uses. WCF service is deployed on IIS 7. We wrote simple WinForms application and added service reference to it. The following code is used:

ServicePointManager.ServerCertificateValidationCallback =
 new RemoteCertificateValidationCallback((o, cert, chain, error) => true);

WcfPortalClient client = new WcfPortalClient();
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;

// Use the 'client' variable to call operations on the service.
Csla.Server.Hosts.Silverlight.CriteriaRequest critRequest = new Csla.Server.Hosts.Silverlight.CriteriaRequest();
critRequest.Principal = Encoding.ASCII.GetBytes("QBhBcnJheU9mU2VyaWFsaXp");
critRequest.CriteriaData = Encoding.ASCII.GetBytes("QBhBcnJheU9mU2VyaWFsa");
critRequest.TypeName = "HCFB.UFO.Customer.Customer, HCFB.UFO.Business, Version=, Culture=neutral, PublicKeyToken=null";
Csla.Server.Hosts.Silverlight.WcfResponse response = client.Fetch(critRequest);


But, this error comes up:

DataPortal.Fetch failed (Attempted to perform an unauthorized operation.)

I'm not sure if we can do something to overcome this issue.

Could someone, please, give some advice?

Thank you in advance.


tesicg replied on Tuesday, August 30, 2011

Does anybody can help or just point to right direction?

Thanks in advance.

JonnyBee replied on Tuesday, August 30, 2011

I assume your exception is thrown here in Csla.Server.DataPortal:

    internal static object Fetch(Type objectType, object criteria)
      Server.DataPortalResult result = null;
      Server.DataPortalContext dpContext = null;

        if (!Csla.Rules.BusinessRules.HasPermission(Rules.AuthorizationActions.GetObject, objectType))
          throw new System.Security.SecurityException(string.Format(Resources.UserNotAuthorizedException,

So could it be that your serialized principal object does not contain the necessary roles/permissions?

Copyright (c) Marimer LLC