天天看点

FCKeditor使用配置(ASP.NET)

FCKeditor的官方网站是:http://www.fckeditor.net/download

1、  FCKeditor_2.6.6.zip中解压出来的fckeditor文件夹发到你项目的根目录下

2、  将FCKeditor.Net_2.6.3.rar/FCKeditor.Net_2.6.3/bin/Release/2.0下的FredCK.FCKeditorV2.dll放到你的项目的Bin(没有就新建一个)文件夹下面这是工具箱里就会多出一个FCKEditor控件,把它拖到一个页面中,如default.aspx。

3、  设置上传文件语言:打开fckeditor目录下的fckconfig.js文件,找到下面的两句话,

var _FileBrowserLanguage    = 'php' ; // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage    = 'php' ; // asp | aspx | cfm | lasso | perl | php | py

改成

var _FileBrowserLanguage    = 'aspx' ;    // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage    = 'aspx' ;    // asp | aspx | cfm | lasso | perl | php | py

4、打开fckeditor/editor/filemanager/connectors/aspx/ config.ascx找到下面的代码

     private bool CheckAuthentication()

     {

         // WARNING : DO NOT simply return "true". By doing so, you are allowing

         // "anyone" to upload and list the files in your server. You must implement

         // some kind of session validation here. Even something very simple as...

         //

         //       return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );

         //

         // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the

         // user logs in your system.

         return false;

     }

把return false;改成return true;

4、   打开web.config文件找到<appSettings/>

把它改成

<appSettings>

    <add key="FCKeditor:BasePath" value="~/fckeditor/"/>

    <add key="FCKeditor:UserFilesPath" value="/FCKEditorTest/Files/" />    <!--上传的目录-->

  </appSettings>

【注意】访问的URL为:http://localhost:3210/FCKEditorTest/Default.aspx

所以要设置为<add key="FCKeditor:UserFilesPath" value="/FCKEditorTest/Files/" />

配置   UserFilesPath,记住格式是 /虚拟根目录/上传文件夹/ 

5、   在网站根目录下新建Files文件夹用来放上传的图片

6、  运行就可以了浏览和上传图片