Hello
i have tried many methods:
1. normal way:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString.Get("formid") != null) { int.TryParse(Request.QueryString.Get("formid"), out formId); hfID.Value = formId.ToString(); DownloadFile(formId); } } }
2.using Thread.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString.Get("formid") != null) { int.TryParse(Request.QueryString.Get("formid"), out formId); hfID.Value = formId.ToString(); ThreadStart starter = delegate { DownloadFile(formId); }; //ThreadStart Thread oThread = new Thread(starter); //oThread.IsBackground = true; oThread.Start(); } } }
3.use asp.net event : Page_Unload
protected void Page_UnLoad(object sender, EventArgs e) { DownloadFile(formId); //base.OnUnload(e); }
4.use javascript.
first, we need to create a new linkbutton event:
protected void LinkButton1_Click(object sender, EventArgs e) { int.TryParse(hfID.Value, out formId); DownloadFile(formId); }
second:
<script language="javascript"> $(document).ready(function() { __doPostBack('dnn$ctr599$DocumentFormDownload$LinkButton1', ''); }); </script>
the way is working on FF,Chrome , but not on IE.
actually , it's working on IE, but we just got an notification,see below:
this way is similar with :http://sourceforge.net/projects/emule/files/eMule/0.50a/eMule0.50a-Installer.exe/download
do you have good way for auto download the file?
any ideas will be appreciated.