Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6065675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:25:00+00:00 2026-05-23T09:25:00+00:00

I am building a Silverlight 4.0 web application for our intranet that will connect

  • 0

I am building a Silverlight 4.0 web application for our intranet that will connect to a server via REST to get data. I am using Visual Studio 2010.

I am using the following code in a method to make the request:

var wc = new WebClient();
const string uri = "http://server/api/statistics.svc/overall/";

wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
wc.OpenReadAsync(new Uri(uri, UriKind.Absolute));

My OnReadCompleted event handler:

void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    var buffer = new byte[e.Result.Length];

    e.Result.Read(buffer,0,(int)e.Result.Length);

    var xmlstr = buffer.Aggregate(String.Empty, (current, t) => current + (char) t);

    // Do something with xmlstr...
}

My issue arises when trying to run the application. The exception is thrown on line one in the wc_OpenReadCompleted event handler and has the following details:

 TargetInvocationException: An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.

The inner exception:

 System.Security.SecurityException: Security error.

My REST service does not use any sort of authentication.

I have created a clientaccesspolicy.xml located at with the following settings:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/api/statistics.svc/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

Your help is greatly appreciated!

Thanks,

Jeffrey Kevin Pry

UPDATE

I wasn’t specifying /api/ in my xml file. The issue is resolved.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:25:01+00:00Added an answer on May 23, 2026 at 9:25 am

    Your Silverlight application is allowed to connect only to the server it was downloaded from and to servers that have a Cross-domain Policy File. This is known as the Same Origin Policy. Connections to any other server are denied for security reasons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My team is building our first significant Silverlight application, using a 3 layered architecture
I'm building a Silverlight application that interfaces with SharePoint Web Services. In a windows
We're building a Silverlight 4 LOB application. However, we're concerned that not all our
We're building a Silverlight application which will be offered as SaaS. The end product
We're building an application that is a Silverlight client application, but we've created an
Currently I'm building an application using latest Prism for Silverlight 4. I've a module
I am building an iGoogle like dashboard for our application with silverlight 4. Each
My team (3 developers) will be building a Silverlight LOB application. This is the
In a Silverlight application I sometimes need to connect to the web site where
I have been building a client / server app with Silverlight, web services, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.