Hi…
you can download csv,excel or image file like jpg ,jpeg,bmp or any formate file from server on local system then
you just use this code and resolve your problem.
This line below find out the actual path of application
string str = App.Current.Host.Source.AbsoluteUri;
// you can replace and get the path of specific folder and file with in it.
str = str.Replace(“ClientBin/SetMyLeads.Silverlight.UI.xap”, “Samplecsv/Sample.csv”);
private void sampleupload_Click(object sender, RoutedEventArgs e)
{
SaveAs();
}
public void SaveAs()
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = “csv Files|*.csv”;
bool? dialogResult = dialog.ShowDialog();
if (dialogResult != true) return;
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += (s, e) =>
{
try
{
using (Stream fs = (Stream)dialog.OpenFile())
{
e.Result.CopyTo(fs);
fs.Flush();
fs.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
};
string str = App.Current.Host.Source.AbsoluteUri;
str = str.Replace(“ClientBin/SetMyLeads.Silverlight.UI.xap”, “Samplecsv/Sample.csv”);
webClient.OpenReadAsync(new Uri(str), UriKind.Absolute);
}