Response.TransmitFile() throws 'Access to the path {path} is denied' using ASP.NET Development Server

StackOverflow https://stackoverflow.com/questions/4971175

문제

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();
도움이 되었습니까?

해결책

Forget it... I had an error in the path (did not exists). I hate paths =P

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top