c# - 如何使用C#在网站页面加载PDF文件

标签 c#

如何使用C#在网站页面加载PDF文件

最佳答案

以下是将文件发送到浏览器的方法。

http://support.microsoft.com/kb/306654

private void Page_Load(object sender, System.EventArgs e)
    {
             //Set the appropriate ContentType.
        Response.ContentType = "Application/pdf";
             //Get the physical path to the file.
        string FilePath = MapPath("acrobat.pdf");
             //Write the file directly to the HTTP content output stream.
        Response.WriteFile(FilePath);
            Response.End();
    }

关于c# - 如何使用C#在网站页面加载PDF文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2631084/

相关文章:

c# - 如何将 Modelstate 错误键设置为驼峰式大小写?

c# - C# 中的方法签名

c# - 从 Web 应用程序访问 SharePoint 文档库?

c# - .net 框架是否支持在不同版本 1.1 和 3.5 之间使用策略文件进行程序集重定向?

c# - 垃圾收集会处理列表列表的值吗

c# - 用于远程调用 Windows 服务方法的体系结构

c# - 复选框列表循环不起作用

c# - LinqToSql 和抽象基类

c# - 我可以使用 C# 在插入语句中调用该函数吗

c# - 用于对存储过程进行分组的单独 EDMX