Force Download PocketIE and Mobile Browsers

Discussion in 'ASP .Net Mobile' started by Mustafa Rabie, Jun 28, 2006.

  1. 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
    Mustafa Rabie, Jun 28, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mustafa Rabie

    Force Download PocketIE and Mobile Browsers

    Mustafa Rabie, Jun 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    389
    Mustafa Rabie
    Jun 28, 2006
  2. prado
    Replies:
    5
    Views:
    350
    prado
    Jun 20, 2006
  3. El Kabong

    Browsers, browsers! Quo vadis?

    El Kabong, May 11, 2007, in forum: HTML
    Replies:
    23
    Views:
    877
    dorayme
    May 13, 2007
  4. chen selina
    Replies:
    0
    Views:
    1,253
    chen selina
    Jul 13, 2010
  5. AtlMobile

    Printing from PocketIE

    AtlMobile, Jul 21, 2003, in forum: ASP .Net Mobile
    Replies:
    3
    Views:
    112
    C. Vollmer
    Jul 25, 2003
Loading...

Share This Page