您的位置:首页 > 其它

.net实例:FCKeditor2.5使用说明(简洁高效)

2008-09-12 10:25 411 查看
Web. Config文件,修改appSettings元素,配置如下:

<appSettings>
<add key="FCKeditor:BasePath" value="~/FCKeditor/"/>
<!--FCKeditor基本文件目录-->
<add key="FCKeditor:UserFilesPath" value="/Files" />
<!--文件上传目录-->

</appSettings>

把.net的bin/FredCK.FCKeditorV2.dll解压引用就行
fckconfig.js里有很多配置保护语言版本,上传等设置

加到网页的步骤:

1.引用bin/FredCK.FCKeditorV2.dll
2.将页面切换到设计模式
3.呼出工具箱,在"常规"选项卡内点击右键,选择"选择项",浏览选择bin/FredCK.FCKeditorV2.dll,点确定后就会在工具箱的"常规"中出现一个控件.
4.在页面处于设计模式时,将此控件拖入网页,然后设置其ID,并在网页的第一行标签里加[ValidateRequest="false"]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
5.在入数据库时将取得值Server.HtmlEncode(),在将数据用编辑器编辑或显示于网页上时将数据Server.HtmlDecode()
6.取得值或判断值时用.value

FCKeditor在.net(asp.net)中的使用方法

安装前需求:

1.FCKeditor.Net_2.5.zip

下载地址:

http://downloads.sourceforge.net/fckeditor/FCKeditor.Net_2.5.zip

2.FCKeditor_2.6.zip

下载地址:

http://sourceforge.net/project/downloading.php?group_id=75348&filename=FCKeditor_2.6.zip

一、安装过程:

1、将FCKeditor.Net_2.5.zip解压缩。我们需要一个DLL文件。在/bin/Release/文件夹下有两个版本。对应.netframework的版本,我的是.netframework2.0的,就在/bin/Release/2.0/下,拷贝FredCK.FCKeditorV2.dll至你的项目的bin目录。然后在.net的工具箱中添加此项。

2、将FCKeditor_2.6.zip解压缩。将所得的fckeditor文件夹拷贝至项目根目录。打开/fckeditor/fckconfig.js

找到:

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

这两行,大致位置在271、272两行。

将这两行中的PHP替换为aspx。

找到:

UserFilesPath = "/userfiles/";

这一行,大概在第50行处。将/userfiles/替换为你的用来存放用户上传文件的文件夹。

保存、退出。

3、在/fckeditor/editor/filemanager/connectors/aspx/文件夹下找到config.ascx用editplus或者文本文档打开,找到:

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;
}

这个函数的作用是根据用户类型判断用户是否有上传文件的权利。如果直接return true;则允许所有用户上传文件。建议在这个函数中判断用户类型,然后在根据判断结果来确定返回值。

修改好以后,保存、退出。

4、在你的项目的配置文件:web.config里找到<appSettings/>将它替换为:

<appSettings>
<add key="FCKeditor:UserFilesPath" value="/upload/" />
</appSettings>

把 value="/upload/" 替换为你的用来保存用户上传文件的文件夹。

如果web.config里没有<appSettings/>这一项,就直接把上面三行代码放到<configuration>里面</configuration>

注意:用来保存用户上传文件的文件夹必须存在,如果不存在,请自己建立。

二、使用方法:

可以直接在ASP.NET设计视图中使用此控件,就像你使用textbox一样简单,直接从工具箱拖到页面上即可。获取FCKeditor的编辑框中的值,可以用FCKeditor的value属性获取编辑框内的值,此数据为html代码。至此,整个安装、使用过程结束!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: