下面是我從網上搜集的資料,也包括我在實際操作中的遇到的問題,特別是路徑設定方面的內容,對於程式開發過程中的地址和發不到IIS中的地址是不一樣的(我自己的感覺,不一定對)
1.FCKeditor的官方網站是:
http://www.fckeditor.net/download
下載 FCKeditor2.4.2.zip和 FCKeditor.NET版的2個zip包(最好用最新版)。
2.分別解壓後把FCKeditor2.4.2.zip裡的
fckeditor目錄整個複製到網站根目錄下。
3.解壓FCKeditor.NET.zip包後在FCKeditor.Net_2.2\bin\Debug目錄裡找到FredCK.FCKeditorV2.dll。其他檔案沒用,把FredCK.FCKeditorV2.dll複製到我們的網站,建立一個Bin目錄。(這一步可以不用做,在添加dll後自動就會建立bin檔案夾)
4.引用FredCK.FCKeditorV2.dll。
第一步:
第二步:
5.匯入工具箱。
在“工具箱”下右鍵
點擊“選擇項”。快顯視窗:
點擊瀏覽,找到dll所在目錄。
這時發現工具箱裡多出FCKeditor控制項。
6.拖拽FCKeditor到頁面上
7.配置WebConfig
<?xml version="1.0"?>
<!--
注意: 除了手動編輯此檔案以外,您還可以使用
Web 管理工具來配置應用程式的設定。可以使用 Visual Studio 中的
“網站”->“Asp.Net 配置”選項。
設定和注釋的完整列表在
machine.config.comments 中,該檔案通常位於
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<appSettings>
<add key="FCKeditor:BasePath" value="~/fckeditor/"/>
<add key="FCKeditor:UserFilesPath" value="~/Files/"/>
</appSettings>
<connectionStrings/>
<system.web>
備忘:我在一開始的時候一直報錯,說xml不能解析之類的,後來發現就是路徑設定錯了,一開始我把FCKeditor:UserFilesPath的value設定成"/Files/",後來我改為="~/Files/"就沒問題了 估計發不到IIS後還得修改路徑才可以。
下面是有篇文章中關於發不到IIS的地址設定的介紹:
下面是另外一個人關於路徑的解釋,我按照做過,每次都失敗。
BasePath是fckeditor所在路徑,fckeditor由於我們直接放網站目錄下這樣寫就可以,如果您的網站多放幾層適當調整即可。
UserFilesPath是所有上傳的檔案的所在目錄。為什麼要設定成/Files這樣而不是~/Files,因為FCKeditor使用這個值來返回你上傳後的檔案的相對路徑到用戶端。否則的話客戶訪問的時候就會取客戶的機器目錄而不是http形式的目錄。
8.Files目錄要有寫的許可權。你根據自己網站需求設定那個帳號,本文為方便設定User實際中你可能用ASP.NET帳號更合理。
9.修改fckeditor/fckconfig.js檔案
在第182行的位置
var _FileBrowserLanguage = 'asp' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'asp' ; // asp | aspx | cfm | lasso | php
改為
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | php
10.FCKeditor給其瘦身。以_打頭的的都是範例檔案或源檔案,不過建議小心。
可能會遇到的問題:
1 。FCKeditor出現"this connector is disabled Please check the"..."錯誤的解決辦法
Code
解決辦法:
開啟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;
}