// just writ this code under button click:
protected void Button1_Click(object sender, EventArgs e)
{
string filename = "qtn.txt";//file name which used to download
string filepath = "README.txt";//where you want to download the file
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename);
Response.ContentType = "application//octet-stream";
Response.TransmitFile(Server.MapPath(filepath));
Response.End();
}
No comments:
Post a Comment