We have a customer that has made some Weblink modifications and placed some buttons on the Weblink DocView page. The problem is some documents don't open with docview. I tested and browsed to a document and receive this url - http://localhost/WebLink8/DocView.aspx?id=26522. I then go to another document in Weblink and receive this url http://localhost/WebLink8/0/doc/26524/Page1.aspx. Why do some documents open with a page1.aspx page instead of DocView? When the document is opened with this page then they don't see the buttons that were added.
Question
Question
Answer
There is a rewrite rule in the web.config file that transforms the second version to the first:
<rewrite url="^~/(.*)/doc/(.*)/Page(.*).aspx(\??)(.*)" to="~/DocView.aspx?dbid=$1&id=$2&page=$3&$5" />
This means that internally, both requests end up executing the same aspx page. The only reason for having the two kinds or URLs are aesthetics, some people think URLs like the second one are prettier, but for technical reasons we weren't able to always use the second kind of URL.
Are you sure that there's no logic in the page that could explain it showing up sometimes but not others? Are there any resources that fail to load? If your page is loaded by the second URL when you expect the first, relative paths to things like images and stylesheets won't work.
It is still true for the most recent version of WebLink, 10.1.
Replies
I don't believe this has anything to do with your custom coding nor the rewrite rules but Laserfiche WebLink coding and logic.
For example, if you go to http://webdemo.laserfiche.com/WebLink8/Browse.aspx?startid=7 and click on the document entitled "Cities Digital Junxure Integration" (at the botom) look at the URL that is displayed whenever DocView.aspx has finished loading. You should see "http://webdemo.laserfiche.com/WebLink8/0/doc/531643/Page1.aspx".
Click the back button and now click on the folder entitled "Agenda Manager" and then click on the document entitled "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/DocView.aspx?id=531522" in the URL bar whenever DocView.aspx has finished loading.
Viewing the HTML source of these two links reveals a difference:
"Cities Digital Junxure Integration"
<a href="0/doc/531643/Page1.aspx" class="DocumentBrowserNameLink"> <nobr> <img src="images/DocPage1.gif" class="DocumentBrowserNameImage"> <span>Cities Digital Junxure Integration</span> <span class="EntryRowIconText">[Icon]</span></nobr> </a>
"Agenda Manager (3)"
<a href="0/doc/531522/Page1.aspx" class="DocumentBrowserNameLink" onclick="__doPostBack('TheDocumentBrowser:_ctl58:_ctl5',''); return false;"> <nobr> <img src="images/DocPage1.gif" class="DocumentBrowserNameImage"> <span>Agenda Manager (3)</span> <span class="EntryRowIconText">[Icon]</span> </nobr> </a>
What stood out immediately was that the "Agenda Manager (3)" link contains an onclick event handler while the "Cities Digital Junxure Integration" link does no contain it. This is why you sometimes get the "DocView.aspx?id=" link. When the link is a pure HTML link then it's handled through the URL Rewriter but when it has a JavaScript callback it's not.
Basically, it appears to be a logic bug because anytime you access "Browse.aspx" without clicking through folders and click on a document within the root of that folder it will always show a rewritten URL. However if you access that same file via clicking through folders to get to it then it's going to show the non-rewritten URL.
Example:
- Click http://webdemo.laserfiche.com/WebLink8/Browse.aspx?startid=524401
- Now click on "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/0/doc/531522/Page1.aspx"
- Now click http://webdemo.laserfiche.com/WebLink8/Welcome.aspx
- Click "Product Brochures" link
- Click on "Agenda Manager" folder
- Click on "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/DocView.aspx?id=531522"
The following code has not been thoroughly tested but may help in this problem with the URL changing. Open up "Browse.aspx" and right before the "</body>" tag copy and paste the following:
<script type="text/javascript"> document.body.onclick = function (e) { e = e || event; var from = findParent('a', e.target || e.srcElement); if (from) { /* it's a link, actions here */ window.location = from.href; } } //find first parent with tagName [tagname] function findParent(tagname, el) { if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) { return el; } while (el = el.parentNode) { if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) { return el; } } return null; } </script>
Save the file and reload it in your browser. Hope this helps!!
Thank you - I knew it was Laserfiche logic and not anything to do with the modifications the client made to the page. I wanted to know if it is possible to force Laserfiche Weblink to always open a document with docview.aspx. We will try the web.config file modification. The documents are all scanned images without any logic.
Hi Susan,
If any of the above responses answered your question, please click the "This answered my question" button on the appropriate post.
If you still need assistance with this matter, just update this thread. Thanks!