.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

android phone download issue from asp.net website

Posted By: yogesh tiwari     Posted Date: December 28, 2011    Points:5   Category :ASP.Net
my android phone download is working n web but not work in android
mobile there download problem.
here is my code-

System.IO.FileInfo _file = new System.IO.FileInfo(_path);
if (_file.Exists)
{

Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + _file.Name);
Response.AddHeader("Content-Length", _file.Length.ToString());
if (_file.Extension.ToLower() == ".zip")
Response.ContentType = "application/zip";
else if (_file.Extension.ToLower() == ".jar")
Response.ContentType = "application/java-archive";
else if (_file.Extension.ToLower() == ".jad")
Response.ContentType = "text/vnd.sun.j2me.app-descriptor";
else if (_file.Extension.ToLower() == ".cab")
Response.ContentType = "application/vnd.ms-cab-compressed";

else if (_file.Extension.ToLower() == ".apk")
Response.ContentType = "application/vnd.android.package-archive";
//Response.ContentType = contentType;
Response.WriteFile(_file.FullName);
Response.End();


Responses
Author: Ramy             
Posted Date: March 04, 2012     Points: 20   

Replace this
Response.AddHeader("Content-Disposition", "attachment; filename=" + _file.Name);

with this
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + _file.Name + "\"");



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend