To enable the document management function of the RichTextEditor control, you must set up a managed document folder.

This is simply a folder in which you will be placing document for your users to use in their content. Create a folder in your application's root folder. (For most applications, this is your web server's root folder, or the folder where your Visual Studio .NET project file is located.) The folder can be named something like "/uploads/", "/documents" or "/UserDocument". Use "~/" (tilde) as a substitution of the web-application root directory.

Make sure that the MACHINE/ASPNET user has Read+Write permissions on this folder and its contents.

How to specify the document path?

You can easily specify the document path using the following methods:

Edit security policy file

The security policy file (default.config, admin.config and guest.config) can be found in the richtexteditor/config folder. In security policy file you can find the following code which defines the document path information within RichTextEditor. By default, insert document dialog has the following settings:


<category for="Document"><!-- Insert Document Dialog -->  
       <security name="Extensions">*.txt,*.doc,*.pdf,*.zip,*.rar,*.htm,*.xls,*.html,*.rtf</security>
       <storage id="default>
              <security name="StoragePath">~/uploads</security>
              <security name="StorageName">Document Files</security><!-- storage display name -->
       </storage>
</category>

If you want to add new folders as document path, you need to create new storages and specify the storgae ID, name, path.

<category for="Document">
       <storage id="newdocumentpath>
              <security name="StorageName">New Document</security><!-- storage display name -->
              <security name="StoragePath">~/newdocumentpath</security>
       </storage>
       <storage id="newdocumentpath2>
              <security name="StorageName">New Document2</security><!-- storage display name -->
              <security name="StoragePath">~/newdocumentpath2</security>
       </storage>
</category>

Programmatically specify the document path

RichTextEditor provides a powerful method named Editor.SetSecurity that allows you programmatically manage the security settings.

1. Set document path using the default storage

Editor1.SetSecurity("Document", "default", "StoragePath", "~/uploads"); 
Editor1.SetSecurity("Document", "default", "StorageName", "Uploads");

This is equivalent to the following code:

<category for="Document"><!-- Document Dialog -->  
       <storage id="default>
              <security name="StoragePath">~/uploads</security>
              <security name="StorageName">Document Files</security><!-- storage display name -->
       </storage>
</category>

2. Create a new storage for insert document dialog and specify the ID, name and path

Editor1.SetSecurity("Document", "newdocumentpath", "StoragePath", "~/newdocumentpath"); 
Editor1.SetSecurity("Document", "newdocumentpath ", "StorageName", "New Document");

This is equivalent to the following code:

<category for="Document">
       <storage id="newdocumentpath>
              <security name="StorageName">New Document</security>
              <security name="StoragePath">~/newdocumentpath</security>
       </storage>
</category>

3. To programmatically disable a storage access, you can use the following method:

Editor1.SetSecurity("Document", "newdocumentpath", "AllowAccess", "false"); 

In the above code, insert document dialog access to a storage is disabled. The storage ID in the above code is "newdocumentpath".


Send feedback about this topic to CuteSoft. © 2003 - 2018 CuteSoft Components Inc. All rights reserved.