+1  A: 

When running a Silverlight application in a browser, the silverlight application may only make requests to URLs from the same domain as the application was installed from. For instance, if your silverlight app is installed from http://yoursite.com/yourapp.xap, you can only make WebClient requests to other URLs on http://yoursite.com/. Your options here are either create a proxy script that requests the WoW armory from your server, and have your silverlight app hit that proxy, or run the silverlight out-of-browser and request full trust.

Edit: Generally the best option is a cross-domain policy file as explained here. Sadly, It does not appear that wowarmory.com implements the cross-domain policy file.

Matt Bridges
Sounds good in theory but this code was adapted from Scott Gu's blog, see http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspxThis example clearly uses digg server on another server. Can you explain your comment compared with this seemly contradictory example?Many thanks!
Dan B
Digg implements a cross-domain policy file for silverlight. Wowarmory.com doesn't :(
Matt Bridges
Nice to know that about digg :)
Dan B
A: 

Hi, you were on the right track, you just need to set the user-agent.

private void button10_Click(object sender, RoutedEventArgs e)
    {
        string url = @"http://eu.wowarmory.com/guild-info.xml?r=Eonar&n=Gifted and Talented"; 
        WebClient wc = new WebClient();

        // HOW DO I ADD A USER AGENT STRING (RESPONSE MAY VARY (I.E. HTML VS XML) IF PAGE THINKS CALL IS NOT CAPABABLE OF SUPPORTING XML TRANSFORMATIONS) 
        //wc.ResponseHeaders["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)";

        wc.Headers[HttpRequestHeader.UserAgent] = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)";
        wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
        wc.DownloadStringAsync(new Uri(url));    
    }

    void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        if (e.Error == null)
        {
            string result = e.Result;

            XDocument ArmouryXML = XDocument.Parse(result);

            ShowGuildies(ArmouryXML);
        }
        else
        {
            MessageBox.Show("Something is complaining about security but not sure what!");
        }
    } 
Nate
ooooo - so that's how you set the user agent string in .net 4.0.Can't wait to try it - I will definately let you know how it turns out!
Dan B
PS - thanks for joining just to answer my question :D
Dan B
I get an error message stating that the user agent can't be modified directly...+ InnerException {System.ArgumentException: The 'User-Agent' header cannot be modified directly.Parameter name: name at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String name, String value) at System.Net.WebHeaderCollection.Add(String name, String value) at System.Net.HttpWebRequest.set_Headers(WebHeaderCollection value) at System.Net.WebClient.CopyHeadersTo(WebRequest request) at System.Net.WebClient.GetWebRequest(Uri address)....
Dan B
Have you tried it yourself? Did you get XML back?
Dan B
Sorry, I did not realize this is a silverlight application.
Nate
Last night I tried it in WPF - your code works a treat there and the whole application works as intended but for some reason I can't understand, it doesn't work in Silverlight.
Dan B
SOLVED - used a WCF service to act as a proxy due to cross domain security and header modification restrictions. Thanks for all the advice.
Dan B
A: 

SOLVED - used a WCF service to act as a proxy due to cross domain security and header modification restrictions. Thanks for all the advice.

Dan B