Error occured while export data from excel
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.
精彩评论