mp3 Force Download

Discussion in 'General troubleshooting' started by Raed, Jun 13, 2011.

  1. Hi,

    I have a web application developed with ASP.Net(C#) which convert youtube to mp3. File force download is working fine in all web browser whether in PC or mobile phones but not on android browser which download only 13 Kb then it says download complete, I understand it http headers issue but I'm not able to figure out what I'm missing, below is my code.

    Any advice will be appreciated.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    ///<summary>
    /// Summary description for HttpExtensions
    ///</summary>
    publicstaticclassHttpExtensions
    {

    publicstaticvoid ForceDownload(thisHttpResponse Response, string virtualPath,string fileName)
    {
    System.IO.FileInfo f = new System.IO.FileInfo(virtualPath + "\\" +
    fileName);
    Response.Clear();
    Response.AddHeader("Content-Disposition", "attachment; filename=\"" + (fileName) + "\"");
    Response.ContentType = "application/octet-stream";
    Response.Flush();
    Response.AddHeader("Content-Length", f.Length.ToString());
    Response.TransmitFile(virtualPath + "\\" + fileName);
    Response.End();
     
     
     
    }
     
    }
     
  2. Ray

    Ray

    Whats the error message you are getting with your Android browser? It could be their browser version that causing the problem. Did you check the browser security setting?
     
  3. I do not get any error messsage, the file not fully downloaded just download 13KB I have been searching for solution to this problem but no luck. I just set the HTTP headr as andriod support says but I think it's kind of bug in android system, I have tried four different borowsers but all give the same result only 13kb downloaded.
     
  4. Ray

    Ray

    Is there a browser security settings on Android? Try looking into that.
     

Share This Page