如何使用带有c#的asp.net将pdf文件保存在一个相关的文件夹中 [英] how to save pdf file in a perticular folder using asp.net with c#
本文介绍了如何使用带有c#的asp.net将pdf文件保存在一个相关的文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
没有询问任何保存对话框我的pdf保存在一个文件夹中
i尝试这样
with out asking any save dialog box my pdf save in a folder
i tried like this
Response.ContentType = "application/pdf";
string fname = "SampleInvoice.pdf";
Response.AppendHeader("content-disposition", "attachment; filename=" + fname + "");
string ServerPath = Server.MapPath("~/NewFolder4/");
HttpContext.Current.Response.TransmitFile(path+fname);
但它不起作用
可以帮助我吗?
but it not working
can any one help me ?
推荐答案
你不能。
客户可以完全控制下载的位置存储的项目(根据其配置,它随浏览器的不同而不同) - 服务器根本不能影响(除非在99.999%的条件下没有出现的情况)
想一想:你不知道客户端是什么类型的设备:它可能是PC,Mac,手机,平板电脑或支持互联网的冰箱。它甚至可能没有文件夹的概念!
You can't.
The client has full control over where downloaded items are stored (and it varies from browser to browser anyway depending on their configuration) - the server cannot influence that at all (except in circumstances which do not occur in 99.999% of conditions)
Think about it: you do not know what kind of device the client is: it could be a PC, Mac, Phone, Tablet, or internet enabled fridge. It may not even have a concept of folders!
这篇关于如何使用带有c#的asp.net将pdf文件保存在一个相关的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文