开发者

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

开发者 https://www.devze.com 2023-01-15 16:51 出处:网络
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.

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

精彩评论

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

关注公众号