I need to download a file from a virtual directory when clicking on a button in sharepoint.
I've tried this:
page.Response.ContentType = "text/vcard";
page.Response.AppendHeader("Content-Disposition", "attachment; filename=" + path);
page.Response.TransmitFile(page.Server.MapPath("~/vcf/" + path));
page.Response.Flush();
page.Response.End();
The problem with this is that I can download the file, but after downloading, I can't do anything on the page. I guess that's the Response.End(), but deleting that line doesn't work because he'll add text to my downloaded file...
Is there an easy solution to this? Or another (working) solution is always welcome...