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 开发者_Python百科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)
You might need a Response.Clear()
to get rid of any bits of html that might be already present in your aspx.
精彩评论