I'm trying to access Azure Storage blobs (via SAS string) from a Silverlight application. A clientaccesspolicy.xml
is present in the $root
blob container, allowing Silverlight access.
I've created a sample Silverlight application with just one button. The button executes the following code:
var request = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(new Uri("http://[mystoragename].blob.core.windows.net/[mycontainername]/[myfilename]?[sasString]"));
request.Method = "GET";
request.BeginGetResponse(r =>
{
try
{
var response = request.EndGetResponse(r);
using (var s = response.GetResponseStream())
{
this.Dispatcher.BeginInvoke(() => MessageBox.Show(s.Length.ToString()));
}
}
catch(Exception ex)
{
this.Dispatcher.BeginInvoke(() => MessageBox.Show(ex.Message));
}
}, null);
Running this code on Internet Explorer produces the expected result - the size of a blob uploaded to Azure Storage. Unfortunately, the same application, when ran in Firefox or Chrome, produces a "Security Error" with no further indication of what might be wrong.
The SAME issue occurs when I try to download a file from a PUBLIC blob container (same code as above, only different URL). The public blob container also has it's own clientaccesspolicy.xml
and crossdomain.xml
files (albeit I don't think these are needed). Again - the code works in IE, but fails to function in Firefox / Chrome.
What could be the issue? Where should I even begin looking for one?
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
lines already (since I also wanted PUT functionality in my SL application). It still doesn't work. As for Fiddler, I'm having some really annoying issues with it ATM, and I can't get it to track SL requests from anything but IE. – Shaamaan