【发布时间】:2015-05-25 15:17:22
【问题描述】:
我正在尝试从获取请求中获取 pdf,但它失败了。当我在 chrome 中检查控制台时,我得到 GET http://localhost:50673/Logbook/PrintPage?bilder=checked net::ERR_CONNECTION_REFUSED。一些IIS问题?我直接在 Visual Studio 2013 中运行它。
这个代码我试过了,
[AsyncTimeout(150)]
[HttpGet]
public async Task<FileResult> PrintPage(bool bilder = false)
{
--------
--------
--------
--------
System.IO.FileInfo file = AsposePDFBuilder.PdfBuilder.ExportForPrint(exportData, hidePronAoInfo, true);
//System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
//response.ClearContent();
//response.Clear();
//response.ContentType = "application/pdf";
//response.AddHeader("Content-Disposition", "attachment; filename=\"" + file.Name + "\"");
//response.TransmitFile(file.FullName);
//response.End();
ViewBag.Result = "Export är nedladdad";
return File(file.FullName, "application/pdf");
【问题讨论】:
标签: c# asp.net asp.net-mvc webforms async-await