【问题标题】:web service not running from aspx page but running fine with ashx pageWeb 服务未从 aspx 页面运行,但在 ashx 页面上运行良好
【发布时间】:2010-09-07 18:51:19
【问题描述】:

当我从处理程序页面 (.ashx) 调用它时,我有一个运行良好的 Web 服务。

我的网络服务返回一个 zip 文件。

但是当我从我的 aspx 页面调用相同的代码时,我得到一个损坏的 zip 文件。调用代码如下,在 ashx 类和 aspx 页面中都相同。请指教

    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)

【问题讨论】:

    标签: asp.net web-services


    【解决方案1】:

    您可能需要 Response.Clear() 来删除您的 aspx 中可能已经存在的任何 html 位。

    【讨论】:

      猜你喜欢
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      • 2023-01-20
      • 1970-01-01
      • 2021-11-03
      • 1970-01-01
      相关资源
      最近更新 更多