TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prabu Spark
NA
124
203.5k
Problem in download a apk files using asp.net c#?
Aug 2 2013 2:26 AM
Hi sir,
I am unable to download a apk files using asp.net c#. I attached the code for your reference. Its working fine in Mozilla firefox of system, but it shows download
incomplete in all android mobiles. Kindly give me the solution for this problem.
Default.aspx.cs
-----------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/msi";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + WebConfigurationManager.AppSettings["filename"].ToString());
Response.TransmitFile(Server.MapPath("~/apk/") + WebConfigurationManager.AppSettings["filename"].ToString());
Response.End();
}
}
Web.config
-------------------
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive"/>
</staticContent>
</system.webServer>
<appSettings>
<add key="filename" value="MyApps.apk"/>
</appSettings>
</configuration>
Reply
Answers (
1
)
Header ---- .ascx file - Can't be displayed properly
how to check files copy are started in folder in c#.net