Saturday, January 5, 2013

Bypass authorization for clientaccesspolicy.xml in self-hosted WCF Data Service

Bypass authorization for clientaccesspolicy.xml in self-hosted WCF Data Service

I have been running up the walls trying to get this working. I have a self-hosted WCF Data Service with a Silverlight 5 client. I am trying to implement custom authentication for it. I have the clientaccesspolicy.xml being served up and everything is working fine without the authentication. But with authorization turned on, the SL 5 client just cannot send the Authorization header no matter what, using NetworkCredentials, creating header in the SendingRequest event etc. This works fine with a WPF client.

I think I finally found the reason, it is probably because the access to clientaccesspolicy.xml is being authenticated. How can I avoid this authentication? I came across this solution:

<location path="clientaccesspolicy.xml"> <system.web>   <authorization>     <allow users="*" />   </authorization> </system.web> 

But how can I implement this programmatically? Any input highly appreciated.

Answers & Comments...

Answer: 1

I finally got it worked out. For anyone having similar issues, check this out : http://social.msdn.microsoft.com/Forums/en-CA/wcf/thread/475ebb39-f42d-4429-98b1-1286af745746

It has to do with the clientaccesspolicy.xml file. It has to be served through a separate service which allows anonymous access.

by : user1718625http://stackoverflow.com/users/1718625




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog