Free Support Forum - groupdocs.com

Error when configuring "GroupDocs.Viewer.WebForms.Sample" project to load a file from an internal server location


#1

I am getting an error in the “GroupDocs.Viewer.WebForms.Sample” project when I replace the “candy.pdf” document to read off our internal file server instead. I just change that one line, and it seems like it is wanting to write over the origin file. Here is the exception:

Cannot create “\FileServerBlah\blahblah\blah.pdf” because a file or directory with the same name already exists.

Again, I have changed nothing whatsoever in the sample code except the one line. I changed
<%= Viewer.ClientCode()
.TargetElementSelector("#test")
.FilePath(“candy.pdf”)
.ZoomToFitWidth()
%>

to

<%= Viewer.ClientCode()
.TargetElementSelector("#test")
.FilePath("\FileServerBlah\blahblah\blah.pdf")
.ZoomToFitWidth()

Why is it attempting to create the directory/file?

Please help!


#2

Hello,


We are sorry to hear that you have such issue. You get such error because in the Viewer initialization you have default root storage path which you should change in case that you need to store files in some other place. Please open Globals.asax.cs and find: Viewer.SetRootStoragePath(Server.MapPath("~/testfiles/"));
Here you should change Server.MapPath("~/testfiles/") to your network path: “\FileServerBlah\blahblah” and then in the View instead of the path simply set only the file name.

Best regards.

#3

Thank you, that works, however I do NOT want the cache directory to be the same as the source directory. Can I configure the cache directory to be somewhere else?(i.e. not on the source store, but on a local store) It won’t be acceptable to write to the source disk.


#4

Hello,


Glad to hear that all work now. To set temp files somewhere else you can use second parameter string workingDirectoryPath of the SetRootStoragePath() method. For more info please check this documentation .

Best regards.

#5

Hello, I tried setting the workingpath, and it did store the cached images there, but it is still writing to the source directory as well(putting a bin file, and caching thumbnails there as well)

How do I prevent ANY writing to the source directory?

Thanks.


#6

Hello,


Thank you for coming back. Yes, you are right currently it works in such way, processing files will be stored in the root storage path and cache files will be stored in the path which you set for “workingDirectory”. Unfortunately currently there is no way to change this behavior on your side but we will investigate this and if it will be possible (will not hurt backward compatibility and some other features) then we will update it and all temp files will be stored in same place.

Sorry for the inconvenience.

#7

Thanks for your explanation. Yes we will not be able to write to the source directory, we need a 100% separate directory for caching/processing.(the source directory should be used in a read-only fashion) Do you know how long this would take to analyze/implement? I’m guessing it wouldn’t take too much since it’s just a configuration path change, but please do let me know.


#8
Hello,

We understand that this issue is important to you. We're not quite sure at the moment when this will be implemented completely. We're expecting to include this fix in our next release however, this estimate is not final at the moment. We have created a ticket in our system (WEB-2104). When the feature will be released you’ll get an email notification.

Thanks for your patience.

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+