Ever since Ian Griffiths' post on a bug in Cross Domain web access and my own experiments, I decided to create a web proxy class that creates web request to a URI from a remote site and passes the data back to the client.
The code preserves Mime Types, so it works with images/media files as well as text based files.
In other words, you can access any file type on the web, regardless of that site's Cross Domain access policy.
Just place this ASPX page on a site whose Cross Domain policy you can control.
Here's the main piece of the code:
// Make new WebClient
WebClient webClientRequest = new WebClient();
// Download data from URI
byte[] requestByteArray = webClientRequest.DownloadData(sourceUriString);
// Match the Mime Types
string contentType = webClientRequest.ResponseHeaders["Content-type"].ToString();
Response.ContentType = contentType;
// Copy the Streams
int requestByteArrayLength = requestByteArray.GetLength(0);
Response.OutputStream.Write(requestByteArray, 0, requestByteArrayLength);
Response.OutputStream.Close();
// Exit the Page
Response.End();
[Download Source Code 3k]