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

本文详细介绍FCKeditor在ASP.NET环境下的安装步骤及配置方法,包括必要的文件配置、环境设置及安全验证等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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代码。至此,整个安装、使用过程结束!


 

 

 

Version 2.5<br>Attention : This version is not compatible with releases before FCKeditor 2.5.1.<br><br>New Features and Improvements:<br><br>[#1548] Compatible with Safari 3.0+ and Opera 9.50+. <br>Added specific project files for Visual Studio .NET 2003 and Visual Studio 2005. It's easier now to open the source in your preferred environment. Builds will end up in the "1.1" (VS2003) and "2.0" (VS2005) folders inside bin/Debug and bin/Release. <br>[#79] The BasePath property now defaults to "/fckeditor/" ("/FCKeditor/" previously). <br>[#79] Introduced the FCKeditor.IsCompatibleBrowser static function, to check if the requesting browser is compatible with FCKeditor. <br>[#79] Introduced the FCKeditor.CreateHtml function, which returns the HTML needed to create an editor instance in the page. <br>[#294] The HtmlEncodeOutput setting is enforced by the editor component, to avoid having to set ValidateRequest="false" on pages using the editor. <br>Several changes to the File Browser and Uploader:<br>Several security checks have been introduced. Upgrading is hightly recommended. <br>The code has been reviewed according to our standards, aligning the FCKeditor.Net File Browser to the same quality and feature level present in other server language implementations of it, like the PHP implementation. <br>The connector can now be fully configured by using the "editor/filemanager/connectors/aspx/config.ascx" file, available with FCKeditor 2.5.1. <br>For file uploads, the file extension is precisely controlled in a list defined in the config.ascx file. <br>It is possible to define different folder locations for each file type. <br>Attention : For security, the connector must be explicitly activated, by setting "Enabled = true" in the config.ascx file. <br>Attention : The default connector path has been changed to "/userfiles/", instead of "/UserFiles/". This change should not impact Windows installations. <br>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值