要下載下傳FCKeditor2.4.2.zip和 FCKeditor.NET版的2個zip包。
說明:
FCKeditor2.4.2.zip是其最新的檔案和圖檔什麼的;
FCKeditor.NET.zip是ASP.NET調用的DLL在裡面。
2.分别解壓後把FCKeditor2.4.2.zip裡的fckeditor目錄整個複制到網站中。
3.解壓FCKeditor.NET.zip包後在FCKeditor.Net_2.2/bin/Debug目錄裡找到FredCK.FCKeditorV2.dll。其他檔案沒用,把FredCK.FCKeditorV2.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>
說明:BasePath是fckeditor所在路徑,fckeditor由于我們直接放網站目錄下這樣寫就可以,如果您的網站多放幾層适當調整即可。
UserFilesPath是所有上傳的檔案的所在目錄。為什麼要設定成/Files這樣而不是~/Files,因為FCKeditor使用這個值來傳回你上傳後的檔案的相對路徑到用戶端。否則的話客戶通路的時候就會取客戶的機器目錄而不是http形式的目錄。
建議:Files要單獨做wwwroot目錄下的一個站點比較好,和我們的站點FCKEditor平行。不要把它放FCKEditor裡,為什麼呢?因為Files是要讓客戶有寫的權限的,如果放FCKEditor下很危險。
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給其瘦身。以_打頭的的都是範例檔案或源檔案,不過建議小心。
11.下面以上傳圖檔示例說明如何使用,
點選“浏覽伺服器”。
彈出視窗很容易報錯
如果報錯XML request error: Internal Server Error(500),很可能就是目錄路徑不對和寫權限沒有。
選擇圖像
最後效果
前台代碼:
<%@ Page Language="C#" validateRequest=false AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ 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>FCKeditor文本編輯器</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fckeditorv2:fckeditor id="FCKeditor1" runat="server" DefaultLanguage="zh-cn" Height="400px" Width="660px"
></fckeditorv2:fckeditor>
</div>
</form>
</body>
</html>
怎麼樣擷取結果呢?FCKeditor1.Value就是。