Response.TransmitFile() 抛出“访问路径 {path} 被拒绝”使用 ASP.NET 开发服务器
我正在尝试使用 Response.TransmitFile() 发送受保护的 PDF 文件(无法直接通过浏览器访问),但收到“访问路径...被拒绝”的消息。我正在使用 ASP.NET 开发服务器,因此我不确切知道正在使用哪个用户帐户。无论如何,我已经为每个人设置了完全控制,但仍然没有运气。
可能是什么原因造成的?也许甚至与权限无关...
我正在使用的代码如下,我不确定是否可以。
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content–Disposition", "attachment; filename=foo.pdf");
Response.TransmitFile(file);
Response.End();
I'm trying to send a protected PDF file (which cannot be accesed directly via the browser) using Response.TransmitFile() but I'm getting "Access to the path ... is denied". I'm using ASP.NET Development Server so I don't know exactly which is the user account that's being used. Anyway I've set Full control for Everyone but still no luck.
What could be causing this? Maybe is not even related to permissions...
The code I'm using is the following, which I'm not sure if it's ok.
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content–Disposition", "attachment; filename=foo.pdf");
Response.TransmitFile(file);
Response.End();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
算了……我的路径有错误(不存在)。我讨厌路径=P
Forget it... I had an error in the path (did not exists). I hate paths =P