FCKEditor 使用方法和出错排除

今天花了一个上午终于完整的把FKCEditor使用起来了。记录下注意点和遇到问题的解决方法

1、下载两个文件(http://ckeditor.com/download

FCKeditor 2.6.6FCKeditor.Net 2.6.4(版本可能会继续更新,自己选择)

2、将FCKeditor 2.6.6解压,把加压后的文件夹fckeditor拷贝到站点的根目录

3、在站点根目录建一个文件夹取名FKCEditerFile(名字自己取啦),这个文件夹是供FCKeditor 上传图片,flash之类的用的。

(这个文件夹下不用自己再创建什么image,flash之类的子文件夹了,FCKeditor 会自己建的)

4、修改web.config

<appSettings>

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

这里value="~/FCKEditerFile/"设置的是新建目录的虚拟路径,有朋友说不要用“~”,我实验过,不这么做在上传文件时会报错。

5、修改\fckeditor\fckconfig.js,找到

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

把语言修改成自己需要的

6、修改\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;
 }

注释部分写的也很明白了,用户登陆的时候把Session[ "IsAuthorized" ]=true;

这里就判断Session[ "IsAuthorized" ].ToString()=="true",再 return true;吧。

这里是控制用户上传权限的。如果为了测试使用方便,这里也可以先设置成 return true;

7、解压FCKeditor.Net 2.6.4,取解压后的\FCKeditor.Net_2.6.4\bin\Debug\2.0\FredCK.FCKeditorV2.dll

如果没有,自己编译一下吧。其他文件没用。

8、在visual studio工具箱中添加这个控件

(工具箱右键:choose item...,然后“浏览”,找到这个FredCK.FCKeditorV2.dll,确定,即可看到)

9、把控件拖动到你的页面上就可以看到了。

是不是很麻烦啊,这个控件功能齐全,还是免费,开源的,所以这点麻烦还是值得的。

取值就是 FCKEditor1.Value啦。

控件还可以切换语言,切换样式,自定义工具栏,具体的可以参考http://ckeditor.com/demo

 

这个没有看到效果前,我遇到了这样的问题

1、this connector is disabled Please check the"editor/filemanager/connectors/aspx/config.aspx

这是第6步没设置好

2、The server didn’t send back a proper XML response. Please contact your system administrator.

这个是web.config中配置虚拟路径时没有使用“~”这种方式(当时看到有朋友博客说不要使用才没加的,结果出错了。)

 

网上还有朋友遇到其他的问题,在我的使用过程中没有碰到,希望对后来者有所帮助吧。

 

posted @ 2010-09-08 14:31  中华  阅读(460)  评论(0编辑  收藏  举报