• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Http Headers in ASP.Net

Raed

Lurker
Dears,

I have a web application developed with ASP.Net(C#) which convert youtube to mp3, it's working fine in all web browser whether in PC or mobile phones but not on android browser, 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>
public static class HttpExtensions
{

public static void ForceDownload(this HttpResponse 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();
&#12288;
&#12288;
&#12288;
}
&#12288;
}
 
Back
Top Bottom