Last post Mar 17, 2013 01:59 AM by MBogert
Mar 04, 2011 01:25 AM|Eswaran_MCA|LINK
I am developing winodws phone application. I need to download and open a file when click "Download File".
i have done this in asp.net by using the follwoing code.. it's working fine in asp.net.
BUT, I need the same functionality in WINDOWS PHONE 7.
protected void btnDownloadFile_Click(object sender, EventArgs e)
private void DownloadFile()
string localfilename = @"E:\sample.txt";
FileStream liveStream = new FileStream(localfilename, FileMode.Open, FileAccess.Read);
byte buffer = new byte[(int)liveStream.Length];
liveStream.Read(buffer, 0, (int)liveStream.Length);
string originalFilename = "downloadedFile.txt";
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + originalFilename);
Mar 04, 2011 02:33 AM|DigiMortal|LINK
Take a look at my blog posting
Windows Phone 7 Series development: reading RSS feeds There is example about how to download content from WP7 without freezing phone UI.
Mar 17, 2013 01:59 AM|MBogert|LINK
I think what the OP is asking about is downloading a file from Internet Explorer by writing it to the response. This does not work in WP7 or WP8 using the code he mentioned, but does work on all desktop browsers.