Using code such as:
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.ContentType = "application/CSV"
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment;filename=FileName.csv")
HttpContext.Current.Response.Charset = ""
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
HttpContext.Current.Response.Write(csvString.ToString())
HttpContext.Current.Response.[End]()
Can I serve a CSV file from a web service call. It doesn't seem to work what am I missing?
I have set up a traditional asp:button
and this serves the file correctly, though the web service returns a 500 server error Thread was being aborted