Saturday, March 24, 2012

Permission to access PDF files from ASP.NET

Hi All,

My web app requires to access a PDF document. However it will not open when
I start to access it using Process.Start("fileName"). Although at the task
manager, it says that the Acrobat service has been started by ASPNET. Is
there something I did wrong or have not done? Pls help.

Thanksryu wrote:
> Hi All,
> My web app requires to access a PDF document. However it will not open when
> I start to access it using Process.Start("fileName"). Although at the task
> manager, it says that the Acrobat service has been started by ASPNET. Is
> there something I did wrong or have not done? Pls help.
> Thanks

You want to open a PDF on the *server*??

Process.Start will open only local (that is: local *to the server*)
processes and will open them on the *invisible* desktop of the ASPNET user.

If you want to open that PDF file on the *client*, you need to send
that file to the client:
Response.AppendHeader("Content-Disposition", "attachment;
filename=myfile.pdf");
Response.ContentType = "application/pdf";
Response.WriteFile("myLocalFile.pdf");
Response.End();

--
Hans Kesting

0 comments:

Post a Comment