c# - Why my code throws thread aborted error? -
i using code download file throws error. please me in handling it.
thread being aborted.
protected void download_click(object sender, eventargs e) { try { string filepath = convert.tostring(attachment); string fullfilepath = ("../../siteimages/" + "donald.jpg"); response.clear(); response.clearheaders(); response.clearcontent(); response.addheader("content-disposition", "attachment; filename=\"" + path.getfilename(fullfilepath) + "\""); response.contenttype = contenttype; response.transmitfile(fullfilepath); //mnglogs.insertauditsinfo("tender downloaded via" + " " + mnglogs.pagename, mnglogs.usermacaddress, mnglogs.useripaddress, userid, "download"); //response.end(); } catch (exception ex) { utility.msg_error(master, ex.message); } }
could download approach work?
try { using (var client = new webclient()) { client.downloadfile(urltofileoninternet, pathtofileoncomputer); } } catch (exception ex) { utility.msg_error(master, ex.message); }
hope helps.
Comments
Post a Comment