RIA Authentication from a Web Services project

我们两清 提交于 2019-12-06 13:22:41

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3835946/ria-authentication-from-a-web-services-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!