FCKEditor2.6.3 配置

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

 

参考链接:http://blog.csdn.net/sytWeibo/archive/2009/07/12/4341641.aspx

参考链接:http://www.cnblogs.com/michaelShao/archive/2010/03/12/1684533.html

首先下载FCKEditor插件

下载网址:http://www.fckeditor.com/

这路需要下载2种文件

1.下载FCKeditor_2.6.6,fckeditor应用程序相关文件。

2.下载FCKeditor.Net_2.6.3,asp.net程序需要的dll文件。

然后创建一个web项目,将下载压缩文件解压。将fckeditor(这个文件夹可以自己改名,如FCKEditor)文件,夹拷贝到项目,删除多余的文件,只保留 editor文件夹,fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplate.xml文件。

创建一个新的文件夹取名叫Files用于存储本地上传到服务器的文件,也是fckeditor浏览服务器文件的位置(文件夹位置和名称根据个人喜好决定)。

接下来进行fckeditor项目配置

1.引入FredCK.FCKeditorV2.dll文件,该文件位于Fckeditor.net_2.6.3/bin/release/2.0/下。

2.在工具栏引用fckeditor控件,工具栏中右键-选择项-.net framework组件-浏览-选择刚才引用的FredCK.FCKeditorV2.dll文件(最好引用项目下FredCK.FCKeditorV2.dll文件)。

3.将控件拖到页面产生如下代码:

 <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server"  Width="800px" Height="300px"></FCKeditorV2:FCKeditor>

注意:BasePath属性可以配置在web.config中,文件夹所在项目位置不同,路径配置也不同根据实际情况而定,

如果路径配置不正确页面将无法显示编辑器。

4.配置userfiles用于存储本地上传到服务器的文件,即fckeditor浏览服务器文件夹的位置代码如下:

  <appSettings>
      <add key="FredCK.FCKeditorV2:BasePath" value="~/FCKEditor"/>
      <add key="FredCK.FCKeditorV2:UserFilesPath" value="/FCKEditor/Files"/>

 </appSettings>

5.配置fckconfig.js中 FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;用设置fckeditor编辑器的皮肤

6.配置fckconfig.js中 FCKConfig.DefaultLanguage 将默认值 en 改为 zh-cn。

代码如下:FCKConfig.DefaultLanguage  = 'zh-cn' ; 

7.配置fckconfig.js中var _FileBrowserLanguage 和 var _QuickUploadLanguage 将默认值 php 改为 aspx

代码如下:var _FileBrowserLanguage = 'aspx' ;var _QuickUploadLanguage = 'aspx' ;

8.配置fckeditor/filemanager/connectors/asp/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 true;
 }

该方法用于验证用户是否具有上传文件的权限,默认return false,这里我们将false改为true。

9.配置config.ascx文件中的SetConfig方法中: UserFilesPath = "/FCKEditor/Files/";该方法也是设置上传的文件夹路径,最好与web.config中设置相同。

10.如果使用时候出现,例如具有现在危险Request.Form的值,已从客户端侦测。

请加入页面page标签中加入 ValidateRuqest=false;

 代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FCKEditor._Default" ValidateRequest="false" %>

原文地址:https://www.cnblogs.com/vihone/p/1769883.html