代码如下(VB语言)
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=" & Server.UrlEncode("详单") & ".xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls" Dim stringWrite As StringWriter = New System.IO.StringWriter()
Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
Dim P1 As Page = New Page()
Dim F1 As HtmlForm = New HtmlForm()
GridView1.EnableViewState = False
P1.EnableEventValidation = False
P1.DesignerInitialize()
P1.Controls.Add(F1)
F1.Controls.Add(GridView1)
P1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()-----经常出下面的错误:
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. 请问要怎么解决?
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=" & Server.UrlEncode("详单") & ".xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls" Dim stringWrite As StringWriter = New System.IO.StringWriter()
Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
Dim P1 As Page = New Page()
Dim F1 As HtmlForm = New HtmlForm()
GridView1.EnableViewState = False
P1.EnableEventValidation = False
P1.DesignerInitialize()
P1.Controls.Add(F1)
F1.Controls.Add(GridView1)
P1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()-----经常出下面的错误:
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. 请问要怎么解决?
http://www.cnblogs.com/insus/articles/2002489.html
尝试设置上传或下载数据流的大小