[ASP. NET] FCKeditor 2.6 + Asp. Net settings

Source: Internet
Author: User

FCKeditor introduction:
Official Website http://www.fckeditor.net/

Official Document http://wiki.fckeditor.net/

Http://www.fckeditor.net/download/default.html

Official demonstration http://www.fckeditor.net/demo/default.html

FCKEditor asp.net settings

Download: http://www.fckeditor.net

(Download two zip packages for fckeditor2.6.zip and FCKeditor. NET2.5)

FCKeditor2.6zip is its latest Javascript files and images;

FCKeditor.NET.zip is an ASP. NET control DLL file.

The following describes how to install, configure, and use FCKeditor in combination with an ASP. NET2.0 project. Before you start, download the FCKeditor package and the FCKeditor. Net Server Control. Enable VWD2005 to create a C # WEB Site project named FCKPro.

FCKeditor installation:

The so-called installation is a simple copy process. Decompress the downloaded fckeditor2.4.2.zip package to the root directory of FCKPro. In this way, a FCKeditor folder is generated under the root directory, which contains all the core files of FCKeditor.

Then decompress the downloaded fckeditor.net.zip file to an empty directory on your hard disk, which is FCKeditor. net source code, you can re-develop it, this article does not involve this content, we just directly use the "bin" Debug directory in the directory of FredCK. FCKeditorV2.dll file.

Add a reference to FredCK. FCKeditorV2.dll in VS2005:

1. Right-click the FCKPro project browser and choose Add Reference ...), Find the Browse tab, locate the extracted FredCK. FCKeditorV2.dll, and click OK. In this case, a bin folder is added to the FCKPro project directory, which contains the FredCK. FCKeditorV2.dll file. Of course, you can also manually copy FredCK. FCKeditorV2.dll directly to FCKPro "bin". VS2005 will automatically compile it during compilation.

2. to facilitate RAD development, we also add the FCKeditor Control to the Toolbox of VS, expand the common label Group of the Toolbox (General), right-click the component (Choose Items ...), Find the Browse button in the dialog box, locate FredCK. FCKeditorV2.dll, and then confirm. At this time, the toolbox shows the control, which saves a lot of declaration code to be added when using the FCKeditor Control during development.

So far, you have completed FCKeditor installation and can use FCKeditor in your project. Of course there are many things to be configured later.

FCKeditor detailed settings:

Go to the FCKeditor folder and edit the fckconfig. js file.

1. This step is required and the most important step.

Modify

Var _ FileBrowserLanguage = 'asp '; // asp | aspx | cfm | lasso | perl | php | py

Var _ QuickUploadLanguage = 'asp '; // asp | aspx | cfm | lasso | php

Change

Var _ FileBrowserLanguage = 'aspx '; // asp | aspx | cfm | lasso | perl | php | py

Var _ QuickUploadLanguage = 'aspx '; // asp | aspx | cfm | lasso | php

2. Configure the Language Pack. English and Traditional Chinese are available. Here we use simplified Chinese.

Modify

FCKConfig. DefaultLanguage = 'en ';

Is

FCKConfig. DefaultLanguage = 'zh-cn ';

3. Configure the skin. There are default, office2003, silver style, etc. here we can use the default.

FCKConfig. SkinPath = FCKConfig. BasePath + 'Skins/default /';

4. You can use the Tab key in the editor. (1 is yes, 0 is no)

Change FCKConfig. TabSpaces = 0; To FCKConfig. TabSpaces = 1;

5. add several common font methods, such:

Modify

FCKConfig. FontNames = 'arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';

Is

FCKConfig. FontNames = '; _ GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana'

6. The default font in the editor is 12px. You can modify the style sheet to meet the requirements. Open/editor/css/fck_editorarea.css and modify the font-size attribute. Such as font-size: 14px;

7. Security.

If your editor is used on the front-end of the Website, you have to consider security. Do not use the Default toolbar on the front-end, either customize the function or use the Basic defined by the system, that is, the basic toolbar,

Modify

FCKConfig. ToolbarSets ["Basic"] = [

['Bold ', 'italic', '-', 'orderedlist', 'unorderedlist', '-', 'link', 'unlink ','-', 'about']

Is

FCKConfig. ToolbarSets ["Basic"] = [

['Bold ', 'italic', '-', 'orderedlist', 'unorderedlist', '-',/* 'link', */'unlink ', '-', 'style', 'fontsize', 'textcolor', 'bgcolor', '-', 'smiley ', 'specialchar', 'replace ', 'preview']

];

This is the Basic I changed. I removed the image function and removed the Add link function, because the image and link and flash and image button adding functions allow the front-end page to directly access and upload files, if I don't change it here, I will upload a Trojan to you. Isn't it ready?

Of course, you can also configure WebConfig to ensure security. Next we will talk about it.

FCKPro Project Settings:

1. Configure WebConfig and add it to the <etettings> node as follows:

<Deleetask>

<Add key = "FCKeditor: BasePath" value = "/project name/fckeditor/"/>

// In Win2003, the Files directory must have the write permission of IIS_WPG users; otherwise, Files may not be uploaded.

<Add key = "FCKeditor: UserFilesPath" value = "/project name/Files/"/>

</AppSettings>

Note: BasePath is the path where fckeditor is located. fckeditor can be written in this way directly under the website directory. If your website has more layers, make appropriate adjustments. UserFilesPath is the directory of all uploaded files. We have created a new file folder and placed it in the project as the directory where the file to be uploaded is located. For convenience, it is recommended that Files be separately used as a site under the wwwroot Directory, which is parallel to our site FCKEditor. Don't put it in FCKEditor. Why? Because Files requires the user to have the write permission, it is dangerous to put the Files in FCKEditor. The Files directory must have the write permission. You can set the account based on your website requirements. This document makes it more reasonable to use an ASP. NET account to set the User conveniently.

2. Compile a simple page in the FCKpro Project

<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Default. aspx. cs" Inherits = "_ Default" validateRequest = "false" %>

<% @ Register Assembly = "FredCK. FCKeditorV2" Namespace = "FredCK. FCKeditorV2" TagPrefix = "FCKeditorV2" %>

// There are two main parameters

// The Default value is <% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Default. aspx. cs" Inherits = "_ Default" %>.

// We need to add the parameter validateRequest = false. Otherwise, an error is returned when html code is submitted.

// The Request. Form value that is potentially dangerous is detected from the client.

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head runat = "server">

<Title> No title page </title>

</Head>

<Body>

<Form id = "form1" runat = "server">

<Div>

<FCKeditorV2: FCKeditor ID = "FCKeditor1" runat = "server">

</FCKeditorV2: FCKeditor>

& Nbsp; </div>

</Form>

</Body>

</Html>

How to get its content? Read the Value Attribute Value of the FCKeditor1 control.

FCKEditor 2.6:

1. FCKeditor "this connector is disabled Please check the" editor/filemanager/connectors/aspx/config. aspx "error Solution

Open editor/filemanager/connectors/aspx/config. ascx and modify the CheckAuthentication () method. true is returned.

C # code

View plaincopy to clipboardprint?
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...
//
// Return (Session ["IsAuthorized"]! = Null & (bool) Session ["IsAuthorized"] = true );
//
//... Where Session ["IsAuthorized"] is set to "true" as soon as
// User logs in your system.

Return true;
}

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...
//
// Return (Session ["IsAuthorized"]! = Null & (bool) Session ["IsAuthorized"] = true );
//
//... Where Session ["IsAuthorized"] is set to "true" as soon as
// User logs in your system.

Return true;
}
2. in the Upload File window, click browse server, and the server didn't send back a proper xml will appear ..... error message: FCKEditor later versions require different types of files to be uploaded to different directories, including directories such as file, image, falsh, and media, which must be created first.

FCKeditor Lite version (attached)

Go to the FCKeditor folder and delete all files and folders starting with "_". These are examples. Only the editor folder and fckconfig are retained. js, fckeditor. js, fckstyles. xml, fcktemplates. xml is enough;

Go to the editor folder and delete the "_ source" folder, which also contains the source file;

Go back to the upper-level directory and enter the filemanager folder. There are two folders: browser and upload. Go to browser "default" connectors, and retain only the aspx folder, and delete the rest; The mcpuk directory can also be deleted; the same is true for upload, and only the aspx folder;

Return to the editor and enter the images folder. The smiley folder contains emoticon icons, including msn and fun. If you want to use your own emoticon icons, you can delete them; if you want to use the emojis here, do not delete them;

Lang contains a Language Pack. If only simplified Chinese characters are used, only fck1_agemanager is retained. js, zh-cn.js two files on the line, it is recommended to keep en. js (English), zh. js (Traditional Chinese) files, fck1_agemanager. js is a language configuration file. With it, it can be used with fckconfig. js settings are paired, corresponding to the corresponding language file, must be retained!

Exit the lang folder and enter the skins folder. If you want to use the default FCKeditor milk yellow, delete the other two folders except the default folder. If you want to use other folders, it depends on your preferences.

So far, the file has been streamlined, from the original 2.55M to the current 797K. Then modify the settings.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.