Output HTML is missing website name in URLs


#1

For our MVC 4 project recently something changed and the output files in the cache folder are missing the application name in the URL. Instead they are localhost/document-viewer/… Because of that we see a 404 error when the documents are rendered.

I have rolled back recent changes and it still occurs. Any pointers on what to change to get the website application name in the URL? I did update to your latest build last week so that may be part of the issue. Before that we were running a version from very early this year.

Debugger output:
http://localhost/document-viewer/GetResourceForHtml?documentPath=6aa8f143-4…c-4dd4-9688-c42b7f2ba2ae.pdf&relativeToOriginal=False&resourcePath=1_0.svg 404 (Not Found)

The HTML output file:







This should be http://localhost/OURSITENAME/document-viewer/…

MVC View Code:
@Html.CreateViewerScriptLoadBlock().LoadJquery().LoadJqueryUi().UseHttpHandlers(false)




#2

Hello Kevitra,


WE are sorry to hear that you have such issue. To resolve it please add SetBaseUrl(β€œhttp://localhost/OURSITENAME”) in the Globals where you have Viewer initialization and also make sure that you have Viewer.InitRoutes(); in the Globals as the first code line of the Viewer initialization.

After that delete all document cache (it failed and will have the issue even after these updates) - best way to delete entire β€œtemp” folder.

Best regards.

#3

Thank you for the quick reply. I added the one line of code to the global.asax but the output HTML still does not have the path. I changed the SetBaseUrl to a fake URL and the page threw CSS/Javascript errors so the viewer is using it for something.

Code in global:
Viewer.InitRoutes();
Viewer.SetBaseUrl(GetSystemConfigurationValue(WEBSITEURL));//verified to be http://localhost/ourappname
Viewer.SetRootStoragePath(GetSystemConfigurationValue(DOCUMENTPREVIEWSTORAGE));

Output HTML:








The groupdocs.viewer.dll is version 2.16.0.0

Thanks

#4

Hi,


Thank you for coming back. First of all in the SetBaseUrk you should set s real root URL of your solution. Also please update the library to the latest version it include fix for such issues.

Best regards.

#5

SetBaseURL is a real URL in our example above, it is a constant variable with β€˜http://localhost/ourapp’.

Upgrading to the newest DLL fixed the issues. Your latest build caused a conflict with log4net. I am opening a new thread for that issue.


#6

Hi again,


Ok thank you I will check the new thread.

Best regards.