Generating Links to Files and Assets Located in Secure Folders


On some occasions, a user may want to know the full path to a file on their site, and generate a link to it directly from the backend. This can be achieved by exploring the <Files> table in the DB and joining the folder and filename value to the site URL.

However, a user must note that there are two types of folders, secure and standard. The links from these two folders differ in the fact that secure folder links are autogenerated using LinkCLicks and the FileTicket attribute by default.

Here are examples of links from the two folders:

  • Secure Folder Link:
  • Standard Folder Link:

When a user creates a folder as a secure folder, DNN will append a ".resources" extension to any file within that folder. As ".resources" is mapped to the 404-handler automatically by it means that a request to that file will be ignored i.e., if a user knew or could guess the URL, a request for "" would serve up that file. However a request for "" would be denied.

This functionality is hardcoded in the system and cannot be changed as it serves to protect files located in secure folders against anonymous downloads. Since the FileTicket attribute is a secure value generated by DNN in execution time and is not stored in the DB, generating links using information in the DB for files located in secure folders will result in a 404 error, as the file will not be found.

This article will provide you with the steps to enable you to autogenerate links to files that are currently located in secure folders.


DNN 9+


  1. Move the content of the assets from a secure folder into a standard folder. This process has to be performed manually.
  2. After the files have been moved, use the following SQL query to generate the link to the files contained in a particular folder:
    ​select concat('http://',s.settingvalue,'/Portals/<portalid>/',f.folder,f.filename) as filepath from files f, portalsettings s where f.portalid=<portalid> and s.PortalID=<portalid> and f.folder like '%<foldername>%' and s.SettingName='DefaultPortalAlias';
    NOTE: The Portal ID value in the query <portalid> should be replaced with the actual PortalID value from the site. This value can be found in the Persona Bar, by going to Manage -> Sites, and setting the view option to ListView. The value for SiteID in the page is the same as PortalID in the DB.


You should now be now able to generate links by exploring the <Files> table in the DB and joining the folder and filename value to the site URL.






Article is closed for comments.