Force Download PocketIE and Mobile Browsers

M

Mustafa Rabie

Hi All,

I am writing an ASP.NET 2.0 Web Application that users can buy and download
pictures, songs, etc. I have a page that servers as the download page that
fetches the file to be downloaded from a physical path on my server,pops up
the Save As dialog and using HTTP Response downloads the file. It works
great off desktop IE, but when i try the same page from PocketIE it just
fetches the image and displays it in IE. How can i make it popup the Save
As dialog in PocketIE? any ideas or maybe another way that this could be
reached?

Here's the code i am using:

if (!IsPostBack)

{

string SessionId = "";

SessionId = Request.QueryString["id"];


if (SessionId != "")

{

FileStream fs;

string szFilePath =
System.Configuration.ConfigurationManager.AppSettings["Path"];

string szFileName = GetFileName(SessionId);

szFilePath = szFilePath + szFileName;

fs = File.Open(szFilePath, FileMode.Open);

byte[] byteBuffer = new byte[fs.Length];

fs.Read(byteBuffer, 0, (int)fs.Length);

fs.Close();

Response.AddHeader("Content-disposition", "attachment; filename=" +
szFileName);

Response.ContentType = "application/octet-stream";

Response.BinaryWrite(byteBuffer);

Response.End();

}

}

}

}

Thanks a lot for your help really appreciated

Mustafa Rabie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top