1、FCKEditor官方下載地址:http://www.fckeditor.net/download。
2、FCKeditor 2.6下載地址:
http://sourceforge.net/project/downloading.php?group_id=75348&filename=FCKeditor_2.6.zip。
3、DLL檔案下載地址:
http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=137125。
配置方法如下:
一、在官方網站上下載解壓後目錄結構如下圖所示:
二、刪除不必要的檔案
從官方下載下來的FCKEditor2.6大小有3.61M(解壓後),其實有很多檔案對於只用ASP.NET的來講是不需要的,我們可以刪除不必要的檔案:
1.根目錄下除editor目錄、fckconfig.js、fckeditor.js、 fckstyles.xml、 fcktemplates.xml這幾個保留,其餘的全部刪除
2.editor/filemanager/connectors目錄中除aspx目錄外全部刪除
3.editor/lang目錄中除en.js、zh.js 、zh-cn.js外全部刪除
4.刪除_samples目錄,當然如果你想看樣本,就不要刪除這個目錄了。
三、FCKEditor2.6的詳細設定
1.fckconfig.js中修改
FCKConfig.ToolbarSets["Default"] = [
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
//上面一段我去掉了一些不常用的功能,可以根據實際需要增加。
FCKConfig.DefaultLanguage = 'zh-cn' ; //原來是en
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py 改成aspx
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
2.在Bin中加入DLL檔案
注意:通過前面提供的DLL檔案下載地址:
http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=137125下載FCKeditor.Net_2.6.3.zip壓縮包,解壓後,將FCKeditor.Net_2.6.3/bin/Debug/2.0目錄下的兩個檔案拷貝到自己網站的bin檔案夾下。
3.配置上傳路徑
編輯FCKeditor/editor/filemanager/connectors/aspx/config.aspx 中修改
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; //原來這裡是 false;不過還是建議看看上面的警告
}
4、WebConfig檔案的配置
<appSettings>
<add key="FCKeditor:BasePath" value="~/fckeditor/"/>
<add key="FCKeditor:UserFilesPath" value="~/Upload/FCKEditor/"/>//我這裡設定在了網站根目錄下的Upload/FCKEditor目錄中,根據實際情況和個人喜好而定。
</appSettings>
l 我們知道,一個檔案夾下面不能存放過多的檔案(據稱Windows下面的目錄下2000為閾值),否則對該目錄的訪問會嚴重影響I/O效能。而FCKeditor的檔案儲存體是在單一的一個目錄進行的。我對FCKeditor進行了擴充,可以在Web.config appSettings對儲存目錄的格式自訂:
以今天的日期為例:這樣產生的檔案上傳子目錄格式為:2008/10-21/。
<add key="FCKeditor:FolderPattern" value="%y/%m/%d/"/>
l 對上傳圖片進行縮放處理
用到FCKeditor圖片上傳功能的情境中,很多是內容的發表。內容中往往不需要幾千像素大小的圖片,比如我的項目中,文章地區最寬也就560像素,所以我做了一個擴充,在Web.config appSettings中可以對圖片的最大寬度進行自訂:
<add key="FCKeditor:MaxWidthOfUploadedImg" value="560"/>
四、將編輯器用到項目中的簡單一實例
首先可以將FCKeditor編輯器空間添加到工具箱中:右鍵【選項卡】-》【選擇項】-》【瀏覽】-》【添加確定】,然後向頁面中拖入FCKeditor控制項即可。
下面是一個簡單的fckTest.aspx頁面:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fckTest.aspx.cs" Inherits="fckTest" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>無標題頁</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<FCKeditorV2:FCKeditor id="OnLinkEditor" runat ="server" ></FCKeditorV2:FCKeditor>
</div>
</form>
</body>
</html>
如何擷取其內容呢。讀取OnLinkEditor控制項的value屬性值即可。
五、IIS下配置(用到UrlRewrite技術時)
① xp的iis使用這個設定:
IIS配置:網站->屬性->目錄->配置(G)...->映射->應用程式擴充->添加
可執行檔:c:"windows"microsoft.net"framework"v2.0.50727"aspnet_isapi.dll
副檔名:.html
動作:限制為 GET,HEAD,POST,DEBUG
指令碼引擎:選中
確認檔案是否存在:不選
② 2003的iis使用這個設定:
IIS配置:網站->屬性->目錄->配置(G)...->映射->萬用字元應用程式對應(執行順序)->插入
可執行檔:c:"windows"microsoft.net"framework"v2.0.50727"aspnet_isapi.dll
確認檔案是否存在:不選
六、常見錯誤
FCKEditor 2.6的問題:
1. FCKeditor出現"this connector is disabled Please check
the"editor/filemanager/connectors/aspx/config.aspx"錯誤的解決辦法:
開啟editor/filemanager/connectors/aspx/config.ascx修改CheckAuthentication()方法,返回true
C# code :
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;
}
2、網站用到了UrlReWrite技術的情況下,會遇到這樣的問題 “找到資源。 說明: HTTP 404。您正在尋找的資源(或者它的一個依賴項)可能已被移除,或其名稱已更改,或暫時不可用。請檢查以下 URL 並確保其拼字正確。
請求的 URL: /fckEditor/editor/fckeditor.aspx” 解決方案如下:
偽靜態設定流程:
1. 開啟IIS管理面板;
2. 選中自己網站的虛擬目錄;
3. 右鍵屬性,選擇【主目錄】,如圖所示:
4. 選擇【配置】,如圖所示:
發現整個網站的偽靜態已經設定好了。
5. 於是找到FCk的目錄fckeditor,單擊右鍵【屬性】,如圖所示:
6. 點擊【建立】,如圖所示:
確定結束。
7. 再點擊【配置】,找到.html的規則,刪除。