473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Response object

KK
Hi,

I am using Response object in vb.net to download an excel sheet with
data.
It worked well and I could download excel file with data. But suddenly
It started downloading only blank excel sheet. even though the data
exists. Do I need to do any refreshing? or do I need to re-start IIS?
Dim dt As DataTable = DSCAG.Tables(0)

Dim strFileName As String = "Downloadfile.xls"
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;
filename=""" & strFileName & """")
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.Charset = ""
EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHTMLTextWriter As New
System.Web.UI.HtmlTextWriter(oStringWriter)

DGCAGReference.DataSource = dt
DGCAGReference.DataBind()

DGCAGReference.RenderControl(oHTMLTextWriter)

Dim strResponse As String = oStringWriter.ToString
strResponse = strResponse.Replace("</td>", "&nbsp;</td>")
Response.Write(strResponse)

Thanks.

Aug 1 '06 #1
2 2289
KK
any ideas on this problem pls?

Thanks
KK wrote:
Hi,

I am using Response object in vb.net to download an excel sheet with
data.
It worked well and I could download excel file with data. But suddenly
It started downloading only blank excel sheet. even though the data
exists. Do I need to do any refreshing? or do I need to re-start IIS?
Dim dt As DataTable = DSCAG.Tables(0)

Dim strFileName As String = "Downloadfile.xls"
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;
filename=""" & strFileName & """")
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.Charset = ""
EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHTMLTextWriter As New
System.Web.UI.HtmlTextWriter(oStringWriter)

DGCAGReference.DataSource = dt
DGCAGReference.DataBind()

DGCAGReference.RenderControl(oHTMLTextWriter)

Dim strResponse As String = oStringWriter.ToString
strResponse = strResponse.Replace("</td>", "&nbsp;</td>")
Response.Write(strResponse)

Thanks.
Aug 2 '06 #2
KK
I have noticed that in the blank excel sheet the excel sheet name is
".xls]Downloadfile[1]". I don't understand why the excel sheet name is
like that.

any ideas?

Thanks

KK wrote:
any ideas on this problem pls?

Thanks
KK wrote:
Hi,

I am using Response object in vb.net to download an excel sheet with
data.
It worked well and I could download excel file with data. But suddenly
It started downloading only blank excel sheet. even though the data
exists. Do I need to do any refreshing? or do I need to re-start IIS?
Dim dt As DataTable = DSCAG.Tables(0)

Dim strFileName As String = "Downloadfile.xls"
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;
filename=""" & strFileName & """")
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.Charset = ""
EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHTMLTextWriter As New
System.Web.UI.HtmlTextWriter(oStringWriter)

DGCAGReference.DataSource = dt
DGCAGReference.DataBind()

DGCAGReference.RenderControl(oHTMLTextWriter)

Dim strResponse As String = oStringWriter.ToString
strResponse = strResponse.Replace("</td>", "&nbsp;</td>")
Response.Write(strResponse)

Thanks.
Aug 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
35
by: Eitan | last post by:
Hello, How can I write a line (with carriage return + line feed) to the client ? response.write("abcd"), continue the last line, and doesn't put cr+lf. response.writeLn is illegal syntax... ...
2
by: RobertHillEDS | last post by:
While using the Soap generated ASP code, I would like to dump the raw contents of the request and response objects using Response.AppendToLog. I have tried using variations of the following code,...
3
by: Farooq Khan | last post by:
why does Response.Write in a method of code-beind class when called from inpage code (i.e in <%---%>), after creating object of that class, fails when called while it works perfectly ok while...
5
by: Michael | last post by:
Hello, I have a separate Database class that handles any database work that all my asp.net pages can use. My problem is, many times I use try/catch to catch errors, and I want to output these...
4
by: Jit Prasad | last post by:
I have been consuming a IBM Websphere (Java) web service using .Net 1.0 front end writen in VB.NET. The proxy class submits a soap request and gets a soap response. When I migrated the front-end...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
2
by: Michael D. Ober | last post by:
When I single step through the code below, it sends back the PDF file that is retrieved in the line fm.GetAccountPDF(...). When I run without single stepping, I get the master page for this page. ...
6
by: mike.gilmore | last post by:
Hi, I'm trying to move all my custom validation code into the master page. Unfortunately anytime I use the response, request, or trace objects in any master page module (other than page_load), ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.