[CLOSED] Can I use Response object in a direct method call?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Can I use Response object in a direct method call?

    Hello I experiment a lot of problem with that.

    Here my direct method :

     <DirectMethod()> Public Sub SaveCharts(ByVal ChartName As String, ByVal chartSVG As String)
    
            Dim ms As New MemoryStream()
            SavePNG(ms, chartSVG, ChartName)
    
            'Convert the memorystream to an array of bytes.
            Dim byteArray() As Byte = ms.ToArray()
            'Clean up the memory stream
            ms.Flush()
            ms.Close()
            ' Clear all content output from the buffer stream
            Response.Clear()
            Response.BufferOutput = True
            Response.ClearHeaders()
            ' Add a HTTP header to the output stream that specifies the default filename
            ' for the browser's download dialog
            Response.AddHeader("Content-Type", "application/force-download")
            Response.AddHeader("Content-Disposition", "attachment; filename=" + ChartName + ".jpg")
            Response.AddHeader("Content-Length", byteArray.Length.ToString())
            ' Add a HTTP header to the output stream that contains the 
            ' content length(File Size). This lets the browser know how much data is being transfered
            ' Set the HTTP MIME type of the output stream
            Response.ContentType = "application/octet-stream"
            ' Write the data out to the client.
            Response.BinaryWrite(byteArray)
            Response.End()
    
        End Sub
    Whatever I try to get the return in the browser, I get a BADRESPONSE erreur with error code 200. so, my method is well executed, but the response is not/bad send.

    To not that
       SavePNG(ms, chartSVG, ChartName)
    is well run and produce attende result. If I save the result to disk, I get the image saved.

    I try a lot of solution since this morning and nothing seems to work. So my question.
    And the fact is direct method run well, but the return no.
    Last edited by Daniil; Jun 12, 2012 at 2:08 PM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 5:03 AM
  2. [CLOSED] Call ajax and wait for response
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 15, 2012, 10:33 AM
  3. Replies: 0
    Last Post: Aug 05, 2012, 10:46 AM
  4. [CLOSED] Uncaught TypeError: Object #<Object> has no method '***'
    By Sevilay Tanış in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 27, 2012, 4:44 PM
  5. how to call direct method in asp.net mvc3
    By waqasde in forum 2.x Help
    Replies: 1
    Last Post: Mar 16, 2012, 9:26 AM

Posting Permissions