hello,
m using vs2008 and want to implement download button..so dat client can easily download wat dey want....plz rply asap

kvprajapati commented: Do not use "leet", "txt" or "chatroom" speak -3

Hi ,

Please find the below code here i gave an example of csv file download here you can change whatever file name type you want
private void Downloadfile()
{
System.IO.FileInfo file = new System.IO.FileInfo(@"D:\csv.csv");

if (file.Exists)
{

Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);

Response.AddHeader("Content-Length", file.Length.ToString());

Response.ContentType = "application/octet-stream";

Response.WriteFile(file.FullName);

Response.End();

}

}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.