How can i make my MSI file download from my Website on Button click
I have my Href for downloading MSI and ZIP files directly by clicking on that. I can download those but when he clicks on that I will have a information where he has to fill the required details. After filling and clicking on Download button he can able to开发者_JAVA技巧 download the required file selected
I write the following but no use
Response.Redirect("/Download/ACHTest.msi");
Try this create 2 links instaed of one and ry to pass the values as follows on Linkbuttons page
protected void lnkMsi_Click(object sender, EventArgs e)
{
HttpContext _context = HttpContext.Current;
_context.Items.Add("val", "lnkMsi");
Server.Transfer("downloadInfo.aspx");
}
protected void lnkZip_Click(object sender, EventArgs e)
{
HttpContext _context = HttpContext.Current;
_context.Items.Add("val", "lnkZip");
Server.Transfer("downloadInfo.aspx");
}
On Download page
if (!IsPostBack)
{
HttpContext _context = HttpContext.Current;
if (_context.Items["val"].ToString() == "lnkMsi")
{
DownloadType = "Msi";
oDownInfo.DownloadType = DownloadType;
}
else if (_context.Items["val"].ToString() == "lnkZip")
{
DownloadType = "Zip";
oDownInfo.DownloadType = DownloadType;
}
else
{
Response.End();
}
}
精彩评论