Free Support Forum - groupdocs.com

Could not find a part of the path


#1
Hello -

I have a website backed by Sitefinity CMS. All of my documents are kept in a database. I am trying to test out the GroupDocs Viewer before purchasing to make sure it will fit our needs. My problem is that even though I have setup the Streaming example exactly the same on my website, I still cannot load a document in the viewer without an error. It seems to still be trying to find the document by mapping a path on the C drive to the website instead of looking on the site itself. All of my documents need to be resolved to a "http://www.websiteaddress.com/docs" in order to resolve correctly.

Below is my code. any ideas what I'm doing wrong?

Thanks
Amanda


<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="Groupdocs.Web.UI" %>



Viewing document from stream
<%=Viewer.CreateScriptLoadBlock().LoadJquery().LoadJqueryUi().UseHttpHandlers()%>

<%= Viewer.ClientCode()
.TargetElementSelector("#test")
.Url("https://www.swiftview.com/tech/letterlegal5.doc")
.ZoomToFitWidth()
%>





#2

Hello Amanda,


Thank you for the request. After checking your code I can see that you have missed some steps:

1. You have not initialized the Viewer - please add such code in to the Globals or some other place which will be hit only once when your application starts
Groupdocs.Web.UI.Viewer.SetRootStoragePath(Server.MapPath("~/testfiles/"));
where “~/testfiles/” is a folder inside your project which will be used as a root storage of the Viewer to store the cache (you can set any name for this folder).
2. In the Viewer widget code you use .URL option but you should use .Stream option since you store your documents as stream. For info about this option and using the streams please check this article
3. I can see that you set .UseHttpHandlers() - since that you should set http handlers in the Web.config (if you doesn’t set the, already), you can find them here (step 4 and 5).

Best regards.