I try to execute this code in Silcerlight 4 contol hosted in webpart:
clientCtx = new ClientContext(ApplicationContext.Current.Url);
clientCtx.ValidateOnClient = true;
clientCtx.Load(clientCtx.Web);
clientCtx.ExecuteQueryAsync(updateConnectionStatus, Failed);
but it fails and go Failed method and I recive error: "The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again."
When I turn off security validation in开发者_JAVA技巧 central administration everything works. How to avoid this issue?
You might have a cross-domain posting issue. See the following SO question that deails how to provision the clientaccesspolicy.xml file to prevent cross-domain posting issues.
How can I add a ClientAccessPolicy.xml file to the SharePoint 2010 root folder?
精彩评论