开发者

RIA Authentication from a Web Services project

开发者 https://www.devze.com 2023-01-18 13:04 出处:网络
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 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 d开发者_运维知识库omain 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消