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 3622986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:19:38+00:00 2026-05-18T23:19:38+00:00

I am trying to get contents of http://www.yahoo.com using WebClient#DownloadStringAsync() . However as Silverlight

  • 0

I am trying to get contents of http://www.yahoo.com using WebClient#DownloadStringAsync(). However as Silverlight doesn’t allow cross domain calls i am getting TargetInvocationException. I know we have to put clientaccesspolicy.xml and crossdomain.xml in our web server root but that is possible only if i have control on my services. Currently Google is not under my control ;), so how do i handle it?

I’ve did a workaround by making a WCF service in my web application and then calling WebClient. This works perfectly but it is rather ineffecient. Is there any other better way than this?

Thanks in advance 🙂

  • 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-18T23:19:39+00:00Added an answer on May 18, 2026 at 11:19 pm

    Silverlight’s cross domain restricitions cause many developers to implement workarounds. If you need to display the html page you get back you should look into Silverlight 4 (WebBrowser) control although this only seems to work when running out-of-browser mode.

    If you need to parse through the content you can try some of the following:

    1. For a managed code solution the proxy service you have already implemented is your best option.

    2. Write a Java applet that returns this information. Silverlight can interopt to javascript which can interopt into Java applets. This also works in the reverse but a little difficult to setup. (If you need more info on this let me know).

    3. Use javascript XmlHttpRequest to get the data you want from the source. This can be difficult when supporting multiple browsers. This link shows an example of how to do this (you will need to scroll down). Javascript get Html

    Code:

    var xmlHttpRequestHandler = new Object();
    var requestObject;
    
    xmlHttpRequestHandler.createXmlHttpRequest = function(){
    var XmlHttpRequestObject;
    if(typeof XMLHttpRequest != "undefined")
    {
        XmlHttpRequestObject = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
      var tryPossibleVersions =["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp"];
        for(i=0;i<tryPossibleVersions.length;i++)
        {
            try
            {
                XmlHttpRequestObject = new ActiveXObject(tryPossibleVersions[i]);
                break;
            }
            catch(xmlHttpRequestObjectError) 
            {
                // Ignore Exception
            }
        }
    }
    return XmlHttpRequestObject;}
    
       function getHtml(){
      var url = document.getElementById('url').value;
      if(url.length > 0)
      {
            requestObject = xmlHttpRequestHandler.createXmlHttpRequest();
            requestObject.onreadystatechange=onReadyStateChangeResponse;
            requestObject.open("Get",url, true);
            requestObject.send(null);
      }}
    function onReadyStateChangeResponse(){
      var ready, status;
      try
      {
            ready = requestObject.readyState;
            status = requestObject.status;
      }
      catch(e) {}
      if(ready == 4 && status == 200)
      {
            alert(requestObject.responseText);
      }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.