Quick Silverlight Tip: Networking in Silverlight 2.0 or my I’m getting HttpStatusCode.NotFound
If you’re trying to implement sample XSS networking with Silverlight as it explained in QuickStart guide, but with your own remote host, you’ll probably get strange "Not Found" error. You’ll check your host, firewall setting, etc and everything looks ok. So what’s the problem?
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://blogs.microsoft.co.il/blogs/tamir"));
req.BeginGetResponse(getResponse, req);void getResponse(IAsyncResult ar)
{
HttpWebRequest req = (HttpWebRequest)ar.AsyncState;
HttpWebResponse res = (HttpWebResponse)req.EndGetResponse(ar);
if (res.StatusCode == HttpStatusCode.OK)
WebClient client = new WebClient(new Uri("http://blogs.microsoft.co.il/blogs/tamir"));
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync();void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
//DONE
}void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
//Update progress
}
The reason for it, two small lines in the guide: "Note that the server hosting the feed must opt-in to cross-domain access by providing a Clientaccesspolicy.xml or Crossdomain.xml file at the root of the domain."
Oh, baby, how can I missed it? Create your own Crossdomain.xml now and put it into root directory of your web server. Remember to register XAP MIME type too
Have a nice day
You may also be interested with:
March 10th, 2008 · Comments (1)
One Response to “Quick Silverlight Tip: Networking in Silverlight 2.0 or my I’m getting HttpStatusCode.NotFound”
Leave a Reply
Discover other tags
My tools
- .NET Framework Detector
- Duplicate images finder
- Exchange Security Policy for Windows Mobile Devices Fix
- Gas Price Windows Vista SideBar gadget
- Israel Traffic Information Windows Vista SideBar gadget
- Localization fix for SAP ES Explorer for Visual Studio
- LocTester
- RTL and LTR in Windows Live Writer
- Silverlight controls library
- Snipping tool integration plugin for WLW
- USB FM receiver library
- Vista Battery Saver
- WebCam control for WPF
- Windows Live SkyDrive attachment for Windows Live Writer
- Wireless Migrator
- WPF Virtual Keyboard




January 1st, 2009 at 12:41 am
Pingback from Quick Silverlight Tip: Networking in Silverlight 2.0 or my I'm … | Quick Work