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
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