469,077 Members | 1,380 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,077 developers. It's quick & easy.

Force Download PocketIE and Mobile Browsers

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.AppSetti ngs["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
Jun 28 '06 #1
0 968

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Kevin Muenzler, WB5RUE | last post: by
13 posts views Thread by ron1972 | last post: by
4 posts views Thread by Microsoft | last post: by
1 post views Thread by JayLembeck | last post: by
4 posts views Thread by howa | last post: by
5 posts views Thread by rn5a | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.