Accept-Ranges不会出现在asp.net响应中

时间:2014-06-24 20:50:16

标签: asp.net

我写了一个简单的asp.net页面来模拟文件下载响应。我添加了以下行来调整响应:

    Response.AddHeader("ETag", "\"" + _EncodedData + "\"");
    Response.AddHeader("Last-Modified", lastUpdateTiemStamp);
    Response.AddHeader("Accept-Ranges", "bytes");

    //Set the ContentType
    Response.ContentType = "application/octet-stream";

    //Add the file name and attachment, 
    //which will force the open/cancel/save dialog to show, to the header
    Response.AddHeader("Content-Disposition", "attachment;filename=" + dItem.FileName);

    //Add the file size into the response header
    Response.AddHeader("Content-Length", (endByte - startBytes).ToString());
    Response.AddHeader("Connection", "Keep-Alive");

我的问题是Accept-ranges在响应头中没有出现,但当我将Accept-Ranges更改为Accept-Ranges1时,此头(Accept-Ranges1)将收到响应头。

只有在Visual Studio中调试项目时才会出现此问题。当我在IIS上时一切正常

0 个答案:

没有答案