views:

11

answers:

1

Hi,

I have a web service which is running fine when i call it from a handler page (.ashx).

My web service returns a zip file.

But when i call the same code from my aspx page then i get a corrupted zip file. Code for calling is below and is same in both ashx class and aspx page. Please advise

    Dim service As New doc()
    Dim b() As Byte
    b = service.GetCoverScanTest(New String() {"50BC2781-E4F9-4C0C-AE32-34D4118BD98F"}, System.Configuration.ConfigurationSettings.AppSettings("eDocsSecurekey").ToString())
    Response.ContentType = "application/zip"
    Response.AddHeader("Content-disposition", "attachment; filename=CoverScan.zip")
    Response.BinaryWrite(b)
+1  A: 

You might need a Response.Clear() to get rid of any bits of html that might be already present in your aspx.

Paddy
Paddy, Thanks for the reply. But that didn't work
Amit
I did response.end() and that worked. Cheers for the pointer
Amit