CKEditor和CKFinder在ASP.NET中的应用,需要的朋友可以参考下。

CKEditor是新一代的FCKeditor,是一个重新开发的版本。CKEditor是全球最优秀的网页在线文字编辑器之一,因其惊人的性能与可扩展性而广泛的被运用于各大网站。而CKFinder是一个功能强大的ajax文件管理器。其简单的用户界面使得各类用户,不管是从高级专业人才,还是互联网初学者,都够直观、快速学习的学习使用它。
网址:
CKEditor :http://ckeditor.com/
CKFinder :http://ckfinder.com/
CKEditor 的使用
准备工作
1. 下载CKEditor并将其解压到Web根目录下
2. 精简目录:
_samples文件夹(示例文件,可以删除)
_source文件夹(源程序文件,可以删除)
changes.html(更新列表,可以删除)
install.html(安装指向,可以删除)
license.html(使用许可,可以删除)
CKEditor的配置(config.js文件)
详细api参数见:http://docs.cksource.com/ckeditor_api/,我的默认配置

复制代码 代码如下:

// 自定义 CKEditor 样式
CKEDITOR.editorConfig = function(config) {
//配置默认配置
config.language = 'zh-cn'; //配置语言
// config.uiColor = '#FFF'; //背景颜色
// config.width = 400; //宽度
// config.height = 400; //高度
// config.skin = 'v2'; //编辑器皮肤样式
// 取消 “拖拽以改变尺寸”功能
// config.resize_enabled = false;
// 使用基础工具栏
// config.toolbar = "Basic";
// 使用全能工具栏
config.toolbar = "Full";
//使用自定义工具栏
// config.toolbar =
// [
// ['Source', 'Preview', '-'],
// ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', ],
// ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
// ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', SpecialChar','PageBreak'],
// '/',
// ['Bold', 'Italic', 'Underline', '-', 'Subscript', 'Superscript'],
// ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
// ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
// ['Link', 'Unlink', 'Anchor'],
// '/',
// ['Format', 'Font', 'FontSize'],
// ['TextColor', 'BGColor'],
// ['Maximize', 'ShowBlocks', '-', 'About']
// ];
};

CKEditor 的应用
1. 在 aspx 页面或者 master 模板页 <head> 标签中加载 ckeditor.js:
<!-- 载入 CKEditor JS 文件 -->
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
2. 修改页面的page指令ValidateRequest="false"
<%@ Page Language="C#" ValidateRequest="false" %>
3. 在<body>标签中使用ckeditor:
<!-- 使用 ckeditor 必须定义 class="ckeditor" -->
<asp:TextBox ID="txtContent" class="ckeditor" TextMode="MultiLine"
Text='<%# Bind("info") %>' runat="server"></asp:TextBox>
4. 获取或设置编辑器中的内容
//获取编辑器中的内容
lblView.Text=Server.HtmlEncode( this.txtContent.Text);
//设置编辑器中的内容
//txtContent.Text = Server.HtmlDecode("<h1>设置内容</h1>");
CKFinder 的使用
准备工作
1. 下载CKFinder的Asp.NET版,将其解压到Web根目录下
2. 复制/bin/Release目录下的ckfinder.dll文件至站点bin目录
3. 精简目录:
_samples文件夹(示例文件,可以删除)
_source文件夹(源程序文件,可以删除)
CKFinder的配置
1. 打开 " \ckfinder\config.ascx ",为SetConfig方法中的 BaseUrl 指定默认路径,如:
// 以userfiles 为默认路径,其目录下会自动生成images、flash等子目录。
BaseUrl = " ~/ckfinder/userfiles/";
// NOTE:注意“ ~/ ”。
2. 与CKEditor集成
打开CKEditor目录中的config.js文件在function 函数中

复制代码 代码如下:

// 自定义 CKEditor 样式
CKEDITOR.editorConfig = function(config) {
……
};

加入如下内容:

复制代码 代码如下:

// 在 CKEditor 中集成 CKFinder,注意 ckfinder 的路径选择要正确。
config.filebrowserBrowseUrl = location.hash + '/ckfinder/ckfinder.html';
config.filebrowserImageBrowseUrl = location.hash + '/ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = location.hash+'/ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = location.hash + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
config.filebrowserImageUploadUrl = location.hash + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images';
config.filebrowserFlashUploadUrl = location.hash + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash';
// config.filebrowserWindowWidth = '800';
// config.filebrowserWindowHeight = '500';

CKFinder的应用
1. 在工具栏中添加站点根目录bin目录中的ckfinder.dll控件
2. 拖放控件到Web页面
3. 修改CKFinder控件属性BasePath为ckfinder目录的相对路径
常见问题
1. 症状:因为安全原因,文件不可浏览。请联系系统管理员并检查CKFinder配置文件。
原因:未设置用户身份验证或者用户未登录。
语句:

复制代码 代码如下:

public override bool CheckAuthentication()
{
return false;
}

解决:在CKFinder的config.ascx文件中修改public override bool CheckAuthentication() 加入用户身份权限验证方法。
2. 症状:未知错误
原因:设置不进行用户身份验证,但是 BaseUrl 路径不对。
语句:

复制代码 代码如下:

public override bool CheckAuthentication()
{
return true ;
}

解决:在CKFinder的config.ascx文件中的public override void SetConfig() 修改
// 以userfiles 为默认路径,其目录下会自动生成images、flash等子目录。
BaseUrl = " ~/ckfinder/userfiles/";
// NOTE:注意“ ~/ ”。
3. 症状:访问带有CKFinder的页面时报错“HTTP 错误 404 - Not Found”
解决:修改CKFinder控件的BasePath属性为ckfinder目录的相对路径

转载于:https://www.cnblogs.com/PocketZ/archive/2010/11/12/1875563.html

(转)CKEditor和CKFinder在ASP.NET中的应用相关推荐

  1. asp.net中使用CKEditor

    CKEditor是新一代的FCKeditor,是一个重新开发的版本.CKEditor是全球最优秀的网页在线文字编辑器之一 网址: CKEditor :http://ckeditor.com/ CKFi ...

  2. CKEditor和CKFinder配置(asp.net)

    一.官方Download 1.CKEditor :点击CKEditor.NET标题下的"Download zip"按钮 Version:CKEditor 3.6.4 for ASP ...

  3. .net中ckeditor,ckFinder的使用

    一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <script type="text/javascript" src= ...

  4. 12.HTML编辑器(CKEditor、CKFinder集成)

    CKEditor原名为FckEditor,是著名的HTML编辑器,可以在线编辑HTML内容. 配置参考文档:主要将ckeditor中的lang.plugins.skins.ckeditor.js.co ...

  5. ckeditor和ckfinder的使用

    下载 1.      将这两个文件夹拷到网站根目录(可以删掉两个文件夹下的_sample示例和_source源码) 2.      在head标签中加入 <script language=&qu ...

  6. CKEditor配合CKFinder的使用

    .net 中如何配置 CKEditor和CKFinder 一.官方Download 1.CKEditor :点击CKEditor.NET标题下的"Download zip"按钮 此 ...

  7. CKEditor和CKFinder及CKEditor配置属性说明

    最近在做一个新闻发布平台,放弃了很早的FCKEditor,使用CKEditor和CKFinder,尽管免费的CKFinder是Demo版本,但是功能完整,而且用户都是比较集中精神发新闻的人,不会在意这 ...

  8. ckEditor 和 ckFinder 的使用

    介绍> CKEditor是新一代的FCKeditor,是一个重新开发的版本. CKFinder是一个功能强大的ajax文件管理器. ------------------------------- ...

  9. ckeditor 和ckfinder配置

    ckeditor+ckfinder配置用法 一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <script type="text ...

最新文章

  1. python timber_如何使用Timber更有效地记录日志
  2. phpcms后台系统怎么去掉html目录_电子笔记本 | 好记性胜过烂笔头?基于python3的知识管理系统...
  3. Ubuntu下安装zsteg隐写工具
  4. BZOJ 2157: 旅游
  5. 解决IntelliJ IDEA报错Failed to read candidate component class: file [ ]; nested exception is org.
  6. 软件开发高手须掌握的4大SQL精髓语句(综合篇)
  7. python自带的PIL库扩展图片大小给图片加上文字描述
  8. Java---集合类框架图
  9. dell 工作站装linux_dell服务器linux系统安装
  10. 软件工程第三次作业——用户体验分析:以“南通大学教务学生管理系统”为例...
  11. 12个思维导图工具,像数据科学家一样结构化地思考
  12. ANSI/ISO C++ Professional Programmer's Handbook(7)
  13. SQL FULL OUTER JOIN
  14. java findLoadedClass实践
  15. 基于Markdown 搭建自己的博客,哪个工具好?
  16. “第四产业”升级,中软国际“蝶变”
  17. VIT attention实现(paddle2.2)
  18. 三大巨头遥遥领先!亚马逊云服务领跑亚太第一,阿里微软紧随其后,腾讯谷歌百度进入前六 | 美通社头条...
  19. 【资源】什么是原生广告 What Is Native Advertising?
  20. STM32F10××中英文手册

热门文章

  1. 关于Python你必须知道的常识
  2. python批量分析表格_Python统计分析execl文件列表值的方法
  3. LSTM block和cell区别
  4. java系列10:ArrayList
  5. java学习之类型转换与越界
  6. TriumphX与Metaverse NFT艺术家RisingSun签署专属合同
  7. 加密钱包和借记卡提供商Swipe即将发布V2版本
  8. 24小时BTC合约大单成交1.52亿美元 现货大单成交1亿美元
  9. 孤立森林(Isolation Forest)算法剖析
  10. 我打败了妈妈 - 张朔