Recently I started putting together a list of search urls that return RSS results and I needed to find out if each particular site supported the required cross-domain policy files. The result was this simple page that does the checking regardless of what url you put in it.
To keep things simple I made it a "script-only" page with no codebehind:
<%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace="System.Xml" %> <script runat="server" language="C#" > protected void Button1_Click(object sender, EventArgs e) { string msg = ""; var uri = new Uri(TextBox1.Text); string host = uri.Host; string scheme = uri.Scheme; string test1 = scheme + "://" + host + "/crossdomain.xml"; var doc = new XmlDocument(); try { doc.Load(test1); msg = doc.OuterXml; // clean up for display in the TextArea msg = msg.Replace("><", ">\r\n<"); } catch { msg = "====================================\r\nNo crossdomain.xml policy file\r\n"; } TextBox2.Visible = true; TextBox2.Text = msg; string test2 = scheme + "://" + host + "/clientaccesspolicy.xml"; try { // clean up for display doc.Load(test2); string test3 = doc.OuterXml; // clean up for display in the TextArea test3 = test3.Replace("><", ">\r\n<"); msg = "======================================\r\n" + test3; } catch { msg = "====================================\r\nNo clientaccesspolicy.xml policy file"; } TextBox2.Visible = true; TextBox2.Text += msg; } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>SILVERLIGHT CROSS-DOMAIN / CLIENTACCESSPOLICY FILE CHECKER</title> </head> <body> <form id="form1" runat="server"> <p> <br /> <asp:Label ID="Label2" runat="server" Font-Names="TAHOMA" Text="SILVERLIGHT CROSS-DOMAIN / CLIENTACCESSPOLICY FILE CHECKER"></asp:Label> </p> <div> <asp:Label ID="Label1" runat="server" Text="URL TO APPLICATION:" Font-Names="Tahoma"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Width="250px">http://</asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Check" Font-Names="Tahoma" /> </div> <asp:TextBox ID="TextBox2" runat="server" Height="500px" TextMode="MultiLine" Visible="False" Width="550px"></asp:TextBox> </form> </body> </html>