开发者

Error occured while export data from excel

开发者 https://www.devze.com 2023-01-28 06:26 出处:网络
I am getting an error while exporting data to an excel sheet. Code Response.Clear() Response.AddHeader(\"content-disposition\",\"attachment;filename=CompletionDatesReport.xls\")

I am getting an error while exporting data to an excel sheet.

Code

Response.Clear()
Response.AddHeader("content-disposition",   "attachment;filename=CompletionDatesReport.xls")
Response.Charset = ""
Response.Cache.SetCacheability开发者_StackOverflow中文版(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As StringWriter = New StringWriter()
Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
gridData.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()

Error

Internet explorer cannot download abc.aspx from www.xyz.com.

Internet explorer was not able to open this internet site.The requested site is either unavailable or cannot be found.Please try again later.


Remove the line no 4

Response.Cache.SetCacheability(HttpCacheability.NoCache)

It will be work.

0

精彩评论

暂无评论...
验证码 换一张
取 消