Sql File Provider Notes

The following guide shows the steps to config MSSQL Server file provider in RichTextEditor.

1. Add Provider code to project

Copy SqlFileProvider.cs file to your application App_Code folder.

2. Create file storage items table in database

Execute fsitems.sql against your existing database or create a new database.

3. Set sql connection string to SqlFileProvider

Update SqlFileProvider.cs to use your custom connection string.

static public string ConnectionString
{
  get
  {
    return "server=(local);database=rtedb;trusted_connection=false;uid=test;pwd=test;";
  }
}

4. Set FileProviderType of RichTextEditor and copy download.ashx to your application

Copy SqlFileProvider/download.ashx to your website folder, you can rename it.

Use SetSecurity method to set the FileProviderType.

Editor1.SetSecurity("*", "*", "FileProviderType", typeof(SqlFileProvider).AssemblyQualifiedName);
Editor1.SetSecurity("*", "*", "StoragePath", "/");
Editor1.SetSecurity("*", "*", "FileProviderArg0", "download.ashx?file=");