How to download a text file while I am using Asp.net 2.0 and Ajax ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Payodhi
    New Member
    • Aug 2007
    • 3

    How to download a text file while I am using Asp.net 2.0 and Ajax ?

    Dim fs As System.IO.FileS tream = Nothing
    fs = File.Open(Serve r.MapPath("Text Files/Agent/" + filenam + ".txt"), System.IO.FileM ode.Open)
    Dim btFile(fs.Lengt h) As Byte
    fs.Read(btFile, 0, fs.Length)
    fs.Close()
    Context.ClearEr ror()
    With Response
    .AddHeader("Con tent-disposition", "attachment;fil ename=" & filenam)
    .ContentType = "applicatio n/octet-stream"
    .BinaryWrite(bt File)
    .End()
    End With

    See, this code block was runing absolutely fine before using Ajax.Ajax does not support Respone.Write.S o what will be the solution ?Awaiting for your reply.
    Please......Ple ase...... Please
Working...