Response object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KK

    #1

    Response object

    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.x ls"
    Response.Clear( )
    Response.Buffer = True
    Response.Conten tType = "applicatio n/vnd.ms-excel"
    Response.AddHea der("Content-Disposition", "attachment ;
    filename=""" & strFileName & """")
    Response.Conten tEncoding = System.Text.Enc oding.UTF7
    Response.Charse t = ""
    EnableViewState = False
    Dim oStringWriter As New System.IO.Strin gWriter
    Dim oHTMLTextWriter As New
    System.Web.UI.H tmlTextWriter(o StringWriter)

    DGCAGReference. DataSource = dt
    DGCAGReference. DataBind()

    DGCAGReference. RenderControl(o HTMLTextWriter)

    Dim strResponse As String = oStringWriter.T oString
    strResponse = strResponse.Rep lace("</td>", "&nbsp;</td>")
    Response.Write( strResponse)

    Thanks.

  • KK

    #2
    Re: Response object

    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.x ls"
    Response.Clear( )
    Response.Buffer = True
    Response.Conten tType = "applicatio n/vnd.ms-excel"
    Response.AddHea der("Content-Disposition", "attachment ;
    filename=""" & strFileName & """")
    Response.Conten tEncoding = System.Text.Enc oding.UTF7
    Response.Charse t = ""
    EnableViewState = False
    Dim oStringWriter As New System.IO.Strin gWriter
    Dim oHTMLTextWriter As New
    System.Web.UI.H tmlTextWriter(o StringWriter)
    >
    DGCAGReference. DataSource = dt
    DGCAGReference. DataBind()
    >
    DGCAGReference. RenderControl(o HTMLTextWriter)
    >
    Dim strResponse As String = oStringWriter.T oString
    strResponse = strResponse.Rep lace("</td>", "&nbsp;</td>")
    Response.Write( strResponse)
    >
    Thanks.

    Comment

    • KK

      #3
      Re: Response object

      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.x ls"
      Response.Clear( )
      Response.Buffer = True
      Response.Conten tType = "applicatio n/vnd.ms-excel"
      Response.AddHea der("Content-Disposition", "attachment ;
      filename=""" & strFileName & """")
      Response.Conten tEncoding = System.Text.Enc oding.UTF7
      Response.Charse t = ""
      EnableViewState = False
      Dim oStringWriter As New System.IO.Strin gWriter
      Dim oHTMLTextWriter As New
      System.Web.UI.H tmlTextWriter(o StringWriter)

      DGCAGReference. DataSource = dt
      DGCAGReference. DataBind()

      DGCAGReference. RenderControl(o HTMLTextWriter)

      Dim strResponse As String = oStringWriter.T oString
      strResponse = strResponse.Rep lace("</td>", "&nbsp;</td>")
      Response.Write( strResponse)

      Thanks.

      Comment

      Working...