1. Time links

    Article: AN0002010Updated: 16.10.2018

    Time links are used for generating a link with validity of several minutes.

    You can use the function e.g. together with webparts, where you display data with a complex access rights. When displaying data together with files, you have to evaluate the access rights at the time of display (together with links to files) and then also at the time of file content download. In order you do not need to place the function to two places, you can generate for files a timelink with a certain validity at the first evaluation (data and links to files display). At the time of the file download a time link is used, that is evaluated before the file download and it is found out if the link is still valid. If the link is not valid, the file is not returned.

    Such approach is used e.g. in the model Knowledge Base. When displaying the article also links to files are displayed. However, the article is displayed to the user when meeting several conditions. In order that the same functionality does not have to be performed before the file download, a time link is used in the links below the article. There is a Guid identifier valid for 10 minutes inserted in URL. After 10 minutes from the displaying page with article the file cannot be downloaded anymore. In such case the sue has to refresh the page in order to recreate time links with a new validity.

    This example shows reading a file for a record and use of a time link with validity 10 minutes:

    var fiInfo = OG.DataRowFile.GetFileInfo(...);
    if (fiInfo != null && fiInfo.Count > 0)
    {
    for (var ff = 0; ff < fiInfo.Count; ++ff)
    {
    var f = fiInfo[ff];
    if (f.IsFile)
    {
    var g = OG.TimeLink.Create(f.GetFileId(), 10);
    var link = '' + f.Name + '
    ';
    ...
    }
    }
    }

    Adding class="nsp" causes not displaying mark of page download (turning wheel).

    For work with time links use object OG.TimeLink.

×