Free Support Forum - aspose.com

Temp folder permissions

We are rendering docs as HTML directly to the browser, but the images are not showing. When you right click the image place holder in the browser, the properties indicate the images are expected to come from file:///C:/Windows/Temp/Aspose.Word.xxxx. I checked and the images are there. I assumed it must be a permissions preoblem, so I started added permissions for the ASP.NET user, IUSR_****, etc. No luck. I even went as far as giving Everyone and Anonymous read access to the temp folder. Still no luck.

I can't find any instructions in the documentation of forum regarding the setup for the temp folders.

1) How do I setup the permissions on a windows server to facilitate the proper rendering of the images in the HTML documents?

2) According to some posts in the forum, you are working on a way to specify the destination path where Aspose.Word places temp files. When will this enhancement be released. Giving permissions away in the system temp folder is not our ideal solution because it creates a potential security issue.

BTW, I think I understand what is happening in here. The HTML markup specifies the location of the image as c:/windows/temp/… Once the browser has downloaded the HTML it is on the local machine and c:/windows/temp… is interpreted as a location on the local machine, but the image file resides on the server.

The images are exported into the windows temp folder only when you are saving the document into a stream. The point is the images must go somewhere. If you save the document into a file, not into a stream, then the images will be saved in the same folder as the file and named uniquely after the name of the file. When the images saved in the same folder as the file, their src= is set to only the file name without a path and that works fine when the HTML file is requested over HTTP.

OK, but it still does not answer my question. I know the files are being saved to a temp folder and it’s ok. I just want to be able to set the permissions on that folder so the images render on the browser.

If you serve those HTML files via IIS, then they should not include C:… path in them. The browser on a remote machine will never be able to access that since it goes via HTTP. If you need to serve the files via IIS, save into a file, then serve. The directory where you save should be accessible for IIS.

I agree. The links should not include "C:\..." references, but they do and we don't seem to have control over it.

We use the Aspose.Word _doc.Save(_stream, FormatHtml) method to create the html stream and then we send the stream to the browser via the response object. We don't manipulate the HTML in any way. The image in question is a just logo on the word document.

SO... how do we a) control the destination temp folder or b) control the naming convention for the HTML src statement or c) set the permissions on the temp folder.

How do we solve the problem?