I try to download .dwg file by WebClient like this:
if (document.QueryString.ContainsKey("url"))
{
Uri url = new Uri(s+document.QueryString["url"]);
WebClient webclient = new WebClient();
webclient.OpenReadCompleted += client_OpenReadCompleted;
webclient.OpenReadAsync(url);
}
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
if (e.Error != null)
MessageBox.Show(e.Error.Message);
else
{
MessageBox.Show("File download complete");
Stream stream = e.Result;
StreamReader streamREader = new StreamReader(stream);
List<string> ii = new List<string>();
listbox.Items.Add(streamREader.ReadToEnd());
//files.Add(stream.ToString(), new BinaryReader(stream));
}
}
Directory "files" contain 2 files: files/1.txt files/2.dwg I can download 1.txt, but when i'm downloading 2.dwg webclient throws new exception "NotFound". How to download any file by webclient in the Silverlight or is there anyone else mehod to download files? I use the following line to access the file: mySite:13866/testWebTestPage.aspx?url=files/1.dwg