sanjay  gupta

sanjay gupta

  • NA
  • 248
  • 0

Downloading Problem

Oct 21 2009 2:56 AM
Sir/Mam In my project i m using download link. On the click of that link it download the files but it gives the source code of that page. It is working fine at the local but when we upload to the server it gives the source code of that page. Plz help me i m sending the coding on Download link try { string str = GridView1.SelectedRow.Cells[5].Text; Response.ContentType = "Application/ms-world"; Response.AddHeader("content-disposition", "attachment;filename=" + str); FileStream sourcefile = new FileStream(@"E:\tec\admin\applicationform\" + str, FileMode.Open); long filesize = sourcefile.Length; byte[] getcontent = new byte[(int)filesize]; sourcefile.Read(getcontent, 0, (int)sourcefile.Length); sourcefile.Close(); Response.BinaryWrite(getcontent); } catch (Exception ex) { }

Answers (1)