Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ASP.Net project. When I run it through VS 2010, I can load PPTX (PowerPoint) and PDF files. After I deployed the project in an IIS 7, the PPTX file can' be opened. The code for opening a .pptx is below:
C#
if (ext.ToUpper() == ".PPTX") {
   System.Diagnostics.Process.Start(sPath);  // sPath - address of the file
}

Besides, I cannot pop out Outlook for email for the project deployed in IIS.
How can this problem be solved? Thanks.
Posted
Updated 14-Nov-13 5:36am
v2
Comments
José Amílcar Casimiro 14-Nov-13 11:41am    
Is the IIS Server in your machine? or is it a server? If it is a server then you're trying to open a process on the server and not on the client.
[no name] 14-Nov-13 11:55am    
Thanks for your post. This IIS server is on my machine. I got another failure in updating records stored in MS Access (can read/query) if depoloyed in he IIS.
José Amílcar Casimiro 14-Nov-13 11:57am    
And the IIS process have an user account capable of raise a process?
[no name] 14-Nov-13 12:04pm    
Not understand your statement. Could you explain? My pages should be open to anyone who can access the pages. Should I do some setup for the users? Thanks.
José Amílcar Casimiro 14-Nov-13 12:11pm    
The IIS Server runs under an user account. For instance MACHINE\Network Service or other account. This account needs to have permission to raise a process (System.Diagnostics.Process.Start).

1 solution

Process.Start will only try to run on the server, which likely wont have office installed. Your better bet would bet to return the file for download either via the response object or by linking it through an iframe and letting the users machine/default prefs decide how to display it.

There may also be some control that you could put on your page that could load the file from the server so it appears more integrated but i've always had better luck just giving them a file and letting the user view the pptx or pdf however they're used to.
 
Share this answer
 
Comments
[no name] 14-Nov-13 14:41pm    
Tried to use Response for PDF and PPTX. Works fine for both in running VS 2010, but not for PPTX as deployed in IIS. My code is below:
WebClient client = new WebClient();
Byte[] buffer = client.DownloadData(sPath);
if (buffer != null) {
Response.ContentType = "application/pdf"; // or "application/pptx";
Response.AddHeader("content-length", buffer.Length.ToString());
Response.BinaryWrite(buffer);
}
SomeGuyThatIsMe 14-Nov-13 14:58pm    
i've found that some newer browsers have issues with getting files that way, you may also have to add the application/pdf and application/pptx mime type to IIS for your website. I've had to do that for m4v and mp4/mpg files. I've also had to flush the buffer when writing files(may not apply here its been a while since i worked on the download code)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900