博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ASP.NET使用FCKEditor_2.6.6与FCKeditor.Net_2.6.3配置(转载)
阅读量:4504 次
发布时间:2019-06-08

本文共 2326 字,大约阅读时间需要 7 分钟。

首先下载FCKEditor插件

下载网址:

这路需要下载2种文件

1.下载FCKeditor_2.6.6,fckeditor应用程序相关文件。

2.下载FCKeditor.Net_2.6.3,asp.net程序需要的dll文件。

然后创建一个web项目,将下载压缩文件解压。将fckeditor文件,夹拷贝到项目,删除多余的文件,只保留 editor文件夹,fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplate.xml文件。

创建一个新的文件夹取名叫userfiles用于存储本地上传到服务器的文件,也是fckeditor浏览服务器文件的位置(文件夹位置和名称根据个人喜好决定)。

接下来进行fckeditor项目配置

1.引入FredCK.FCKeditorV2.dll文件,该文件位于Fckeditor.net_2.6.3/bin/release/2.0/下。

2.在工具栏引用fckeditor控件,工具栏中右键-选择项-.net framework组件-浏览-选择刚才引用的FredCK.FCKeditorV2.dll文件(最好引用项目下FredCK.FCKeditorV2.dll文件)。

3.将控件拖到页面产生如下代码:

 <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" BasePath="~/fckeditor/" Width="800px" Height="300px"></FCKeditorV2:FCKeditor>

注意:BasePath属性不是自动生成,需要自己手动添加fckeditor应用程序文件夹路径,该路径可以配置在web.config中,文件夹所在项目位置不同,路径配置也不同根据实际情况而定,

如果路径配置不正确页面将无法显示编辑器。

4.配置userfiles用于存储本地上传到服务器的文件,即fckeditor浏览服务器文件夹的位置代码如下:

  <appSettings>

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

5.配置fckconfig.js中 FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;用设置fckeditor编辑器的皮肤

6.配置fckconfig.js中 FCKConfig.DefaultLanguage 将默认值 en 改为 zh-cn。

代码如下:FCKConfig.DefaultLanguage  = 'zh-cn' ; 

7.配置fckconfig.js中var _FileBrowserLanguage 和 var _QuickUploadLanguage 将默认值 php 改为 aspx

代码如下:var _FileBrowserLanguage = 'aspx' ;var _QuickUploadLanguage = 'aspx' ;

8.配置fckeditor/filemanager/connectors/asp/config.ascx文件,

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;

 }

该方法用于验证用户是否具有上传文件的权限,默认return false,这里我们将false改为true。

9.配置config.ascx文件中的SetConfig方法中: UserFilesPath = "/fckeditor/userfiles/";该方法也是设置上传的文件夹路径,最好与web.config中设置相同。

10.如果使用时候出现,例如具有现在危险Request.Form的值,已从客户端侦测。

请加入页面page标签中加入 ValidateRuqest=false;

 代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FCKEditor._Default" ValidateRequest="false" %>

11.如果更多细节问题,请阅读转载的原文:

转载于:https://www.cnblogs.com/zengjun1980/archive/2011/01/21/1941081.html

你可能感兴趣的文章
Response.StatusCode的HTTP状态代码列表
查看>>
win7下maven安装和配置
查看>>
C# 多线程编程 ThreadStart ParameterizedThreadStart
查看>>
Android Camera Parameters 方法出错,求教
查看>>
一个仿照系统UIAlertView写的提示框
查看>>
Genymotion集成到Eclipse
查看>>
代码简洁之四 统一抽象层次
查看>>
IOS 缩放图片常用方法
查看>>
极速理解设计模式系列:1.建造者模式(Builder Pattern)
查看>>
软件工程课
查看>>
Pycharm-连接服务器
查看>>
[Leetcode] The Skyline Problem
查看>>
okhttp异步请求流程和源码分析
查看>>
【集合框架】JDK1.8源码分析之Comparable && Comparator(九)
查看>>
Flutter之内置动画(转)
查看>>
MyBatis中关于SQL标签的用法(重用SQL 代码段)
查看>>
hdu 1233 还是畅通工程 (最小生成树)
查看>>
unity 定时器
查看>>
Graphics.DrawMeshInstanced
查看>>
freemarker 数字,字符的操作
查看>>