• 配置参考文档,主要将ckeditor中的(adapters、images、lang、plugins、skins、themes、ckeditor.js、config.js、contents.css)解压到js目录,然后“显示所有文件”,将ckeditor的目录“包含在项目中”,在发帖页面引用ckeditor.js,然后设置多行文本框的class="ckeditor"(CSS强大)(服务端控件CssClas=" ckeditor ",客户端控件要设定cols、rows属性,一般不直接用html控件),代码中仍然可以通过TextBox控件的Text属性来访问编辑器内容。
  • 由于页面提交的时候asp.net会把富文本编辑器中的html内容当成攻击内容,因此需要在aspx中的Page标签中设置 ValidateRequest="false" 来禁用攻击检测(2010中还要根据报错信息修改WebConfig来禁用XSS检测)。
  • CKFinder是一个CKEditor插件,用来为CKEditor提供文件的上传的功能。将bin\Release下的CKFinder.dll添加到项目的引用;将core、ckfinder.js、ckfinder.html、config.ascx解压到CKFinder自己的目录。按照文档修改CKEditor的config.js,将上传的处理程序设定为CKFinder,注意路径的问题。
  • 使用测试,在插入超链接、插入图片、插入文件中都有“上传”
  • 因为上传文件是非常危险的动作,因此在文件上传的时候会进行权限校验。在config.ascx的CheckAuthentication方法中校验是否有权限上传,返回true表示有权限,否则没有权限,一般修改成判断用户是否登录,并且登录用户是有上传权限的用户,可以用Session或者Membership来做。思考:如何实现只有指定IP地址的用户才能上传?
  • 在SetConfig函数中设置上传文件夹的位置BaseUrl、缩略图的位置,每种类型数据的上传路径、允许上传的文件类型AllowedExtensions等。

为了使用ckfinder还需要在vs2010的web.config中加入
 <!--为了使用ckeditor-->
        < pages validateRequest ="false " />
        < httpRuntime requestValidationMode ="2.0 " />
 <!-- 为a了使用ckeditor -->
以及



  • 使用ckfinder的配置,在ckeitor的config.js文件中加入如下
  • 还需要复制出“CKFinder.dll”添加到项目的引用中

var ckfinderPath = "/SCDAadmin/js" ;
    config.filebrowserBrowseUrl = ckfinderPath + '/ckfinder/ckfinder.html';
    config.filebrowserImageBrowseLinkUrl = ckfinderPath + '/ckfinder/ckfinder.html?Type=Images' ;
    config.filebrowserFlashBrowseLinkUrl = ckfinderPath + '/ckfinder/ckfinder.html?Type=Flash' ;
    config.filebrowserUploadUrl = ckfinderPath + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files' ;
    config.filebrowserImageUploadUrl = ckfinderPath + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images' ;
    config.filebrowserFlashUploadUrl = ckfinderPath + '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash' ;


这时候还是有安全限制

打开ckfinder的config.ascx
修改里面的
public override 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 on your system.
              object obj = Session["admin_login" ];
        if (obj != null && Convert.ToBoolean(obj) == true)
            return true ;
        else
            return false ;
               return false ;
               }


Ckeditor配置的更多相关文章

  1. CKeditor 配置使用

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

  2. MVC5富文本编辑器CKEditor配置CKFinder

    富文本编辑器CKEditor的使用 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...

  3. 富文本编辑器 CKeditor 配置使用+上传图片

    参考文献: 富文本编辑器 CKeditor 配置使用 CKEditor与CKFinder的配置(ASP.NET环境),老版本可以参考 CKEditor+CKFinder ASP版在本地电脑中的配置  ...

  4. ckeditor、ckeditor配置--整合

    1.将ckeditor和ckfinder文件夹拷入项目文件夹中,刷新项目. 2.ckfinder把文件夹中的bin目录下的dll文件(CKFinder.dll)添加到网站的引用中,防止出现找不到类的错 ...

  5. CKEditor配置及使用

    注:使用CKEditor版本为js版本的CKEditor 4,所有配置均参考自CKEditor官方API:http://docs.ckeditor.com/,以及实践经验 一.快速使用 1.引入CKE ...

  6. 富文本编辑器 CKeditor 配置使用 (带附件)

    Ckeditor下载地址:http://ckeditor.com/download 1.CKeditor的基本配置 var textval=CKEDITOR.instances.TextArea1.g ...

  7. 富文本编辑器 CKeditor 配置使用

    作者:Tyler Ning出处:http://www.cnblogs.com/tylerdonet/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连 ...

  8. struts2+ckeditor配置图片上传

    又是一个漫漫长夜. 公司的编辑器坏了,用的是百度编辑器,上传图片的网址被框架给拦截了,我们本地怎么测试都没问题,放到服务器就这样了.和老李找了半天,疯了,没原因的. 笔者以前用过jsp+ckedito ...

  9. CKEditor+SWFUpload实现功能较为强大的编辑器(一)---CKEditor配置

    CKEditor爆表的强大功能大家都有目共睹,号称最强大的在线编辑器,只要将文件复制到项目中,在添加引用,在一句代码就可以将普通的textarea变成华丽的编辑器 所谓一复制,一拖,一换就大功告成 但 ...

随机推荐

  1. 精简CSS

    1.简化你的注释 2.简化颜色代码 3.使用单行属性代替多行属性 4.值为0时可省略单位 5.同时设置多个元素的属性用分组形式 6.删除空白和换行 7.设定过期时间

  2. BeautifulSoup抓取列表页锚文本

    素闻BeautifulSoup提取效率低,艾玛,第一印象果然是很要命的,反正比Re 和 Lxml 是要慢的,不过就无奈Re的正则折腾来折腾去,没写出来,Lxml 的 Xpath 又用得不好. 不过就这 ...

  3. Zend Studio 无法打开的解决办法

    今天郁闷的...正在写代码,突然 computer 嗝屁了,断电后自动重启了一次,开机后就悲剧了,Zend Studio 9 无法打开了,每次运行只弹窗个 请查看项目错误日志的提示 然后就没反应了.. ...

  4. PHP全角半角转换函数

    之前试过网上找的通过ASCII之类的字符替换,发现很多莫名其妙的问题.最后还是换成下面的字符替换方式了,把目前能找到的所有全角都列出来了一个个替换吧 /** * 全角字符转换为半角 * * @para ...

  5. php 关联数组

    <?php header("content-type:text/html;charset=utf8");$fruit = array(    'apple'=>&quo ...

  6. setTimeout 定时器用法

    setTimeout($(".msg").slideUp(5000));  msg的div 5秒往上收边 setTimeout("函数名称",1000);

  7. onkeyup事件

    当用户释放键盘按钮时执行Javascript代码. 上代码: <input type="text" id="frame" onkeyup="my ...

  8. 配置nginx为HTTPS服务器

    默认情况下ssl模块并未被安装,如果要使用该模块则需要在编译时指定–with-http_ssl_module参数,安装模块依赖于OpenSSL库和一些引用文件,通常这些文件并不在同一个软件包中.通常这 ...

  9. .Net Core Identity外面使用Cookie中间件

    1.在 app.UseMvc 前面加上app.UseCookieAuthentication app.UseCookieAuthentication(new CookieAuthenticationO ...

  10. erlang四大behaviour之二-gen_fsm

    来源:http://www.cnblogs.com/puputu/articles/1701012.html 今天介绍erlang的一个非常重要的behaviour,就是gen_fsm-有限状态机,有 ...