最近闲来无事,看了下FCKeditor 出现如标题的错误,特记录备忘!
第一步:新建一个项目:FCKEditorTest。
第二步:在工具栏中将FredCK.FCKeditorV2.dll,这个文件在FCKeditor.Net_2.5\bin\Release\2.0目录下,导入后就可以在工具栏上看到FCKEditor这一项了。
第三步:将FCKeditor_2.6目录下的fckeditor目录Copy到网站的根目录下。然后打开fckeditor目录下的fckconfig.js文件,找到以下的变量,将它们的值修改为aspx,如下:
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
第四步:找到fckeditor\editor\filemanager\connectors\aspx\config.ascx文件,将这个控件的CheckAuthentication()函数的返回值改为true,如下:
这一设置是为了允许在编辑器中上传图片
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 true;
}
第五步:建立一个保存图片的文件夹,用户上传的图片就保存在这个文件夹中,我在网站的根目录下建立名为UploadImages文件夹。
第六步:配置web.config,在它的appSettings节中加入
FCKEditor就可以使用了
// HTTP Error 404 - Not Found.这个错误的原因就是未使用此设置
<addkey="FCKeditor:BasePath"value="~/fckeditor/"/>
//XML Request Error, Internal Server Error (500)的原因是未使用此设置
<addkey="FCKeditor:UserFilesPath"value="~/fckeditor/ UploadImages /"/>
完成以上简单的设置后,