views:

32

answers:

1

Hi All,

I have a silverlight app using RIA services. I want to reuse the RIA services component and call it from another web service. The web service and the RIA services component will be on the same server.

I have got quite far along, my web service project has a 'service reference' to the RIA services project which is all good. But when I call one of the RIA services methods I get the exception,

{DDB20766-F78A-42c7-B777-5ECF0AD9E4F3}Access to operation 'GetValidId' was denied.
at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodPermissions(DomainOperationEntry domainOperationEntry, Object entity)

The RIA services domain class has the attribute [RequiresAuthentication]. I am trying to understand how I can specify those credentials and authenticate?

Just as a test I commented out the attribute [RequiresAuthentication] and everything worked without any problems.

A: 

Check out this link:

http://www.ben-morris.com/using-the-wcf-authentication-service-without-cookies

Basically, you have to first successfully authenticate against your server, and have the server send back to you an authentication cookie that you can programatically add to subsequent requests to WCF RIA methods with [RequiresAuthentication] turned on.

Note, to get this to work, in your client program, when setting up WCF bindings to call your server WCF RIA methods, ensure allowCookies="false"; this will allow the code from the above link to actually be able to manually set the cookies in the header.

RichardI