在asp.net中显示PDF的方法:

一、直接显示,使用的还是原页面的URL
Response.ContentType = "application/pdf";

Response.Clear();

Response.TransmitFile(@"SharePoint.pdf");

Response.End();

 

二、以PDF文件做为URL进行显示

Response.Redirect("Sharepoint.pdf");

三、点击进行下载
Response.ClearHeaders();

Response.ContentType = "application/pdf";

Response.Clear();

Response.AppendHeader("Content-Disposition", "attachment;Filename=SharePoint.pdf");

Response.TransmitFile(@"SharePoint.pdf");

Response.End();

 

 

 

相关文章: