开发者

web service not running from aspx page but running fine with ashx page

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜