在Adobe Reader中打开PDF,而不是在浏览器中打开

Com*_*r7G 4 c# pdf asp.net

从电子邮件中的链接单击时,以下代码会导致在浏览器中打开PDF文档:

Response.ContentType = mime;
Response.WriteFile(path);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Run Code Online (Sandbox Code Playgroud)

有没有办法迫使客户在Adobe Acrobat/reader中原生地打开它?

Yah*_*hia 5

客户端的行为方式取决于几个方面,包括客户端设置......你可以试试这个

Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename="+filePath); 
Response.WriteFile(path);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Run Code Online (Sandbox Code Playgroud)