Assuming that you have WorkSite Web installed somewhere, you can construct a fully-qualified URL directly to WSW:http/<server>/<virtual_directory>/scripts/ViewDoc.aspx?nrtid=<document_moniker>&command=okWhere <server> is the the server name for WSW<virtual_directory> is the virtual directory on the server<document_moniker> is a valid document monikerIf a user does not have access to a given document, this .aspx page will throw an access denied exception and prevent the user from downloading the file.
<?php/** * WorkSite Dynamic URL Links PHP Script * tested with WorkSite 8.2 / PHP versions 4 & 5 * * usage: http://path/to/webfolder/?id=<DOCUMENT_ID> * * optional, specify document version: * * http://path/to/webfolder/?id=<DOCUMENT_ID>&ver=<VERSION_NUMBER> * **/// change these constants for your environmentdefine ("SERVER_NAME", "PERSDM01");define ("DATABASE_NAME","PERDM01");// custom HTML page for instructions on how to create valid linksdefine ("ERROR_HTML_PAGE", "link_not_valid.html"); // check if document ID has been specified and check it is numericif (!isset($_GET['id']) || (!is_numeric($_GET['id']))){ header("location: " . ERROR_HTML_PAGE); exit;}$docid = $_GET['id'];// check if document version has been specified (version 1 is the default)if (isset($_GET['ver'])){ $docversion = $_GET['ver'];}else{ $docversion = "1";}// output the custom headers to serve the WorkSite documentheader('Content-type: application/nrl');header('Content-Disposition: attachment; filename=' . $docid . '_' . $docversion . '.nrl');// generate the content of the linkecho SERVER_NAME . "\n!nrtdms:0:!session:" . SERVER_NAME . ":!database:" . DATABASE_NAME . ":!document:" . $docid . "," . $docversion . ":";?>
Very cool solution, indeed. I am not familiar with Perl, but it looks like you're building a dynamic NRL file and sending that to the browser. Is this correct? If so, then I'd like to mention that this code will only work if the client machine has DeskSite or FileSite installed.
http://server/worksite/ViewDoc.aspx?nrtid=****&userID=jdoe&password=myPetsName