How to configure and use FCKeditor in ASP. NET?

Source: Internet
Author: User

How to configure and use FCKeditor in ASP. NET? Take FCKeditor2.63 as an example to describe how to configure and use the materials found on the Internet.

Download FCKeditor2.63

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

Dll controls: http://jaist.dl.sourceforge.net/project/fckeditor/FCKeditor.Net/2.6.3/FCKeditor.Net_2.6.3.zip

Image JS file: http://jaist.dl.sourceforge.net/project/fckeditor/FCKeditor/2.6.3/FCKeditor_2.6.3.zip

FCKeditor installation and configuration

Decompress FCKeditor.Net_2.6.3.zip, find FredCK. FCKeditorV2.dll, and add reference to Bin.

Decompress FCKeditor_2.6.3.zip and put the fckeditor folder in the project root directory.

1. Configure WebConfig

<Deleetask>
<! -- Configure the path of FCK to the root directory -->
<Add key = "FCKeditor: BasePath" value = "~ /Fckeditor/"/>
<! -- Configure the location of the FCK file to be saved relative to the root directory. manually create a folder. -->
<Add key = "FCKeditor: UserFilesPath" value = "~ /UploadFiles "/>
</AppSettings>

Note: Some people send value = "/fckeditor/" here. If it is in project mode, there will be no errors, but if it is in website mode, or if the project is finally published as a website, an error will still be reported.

Use value = "~ /Fckeditor/", which is good.

2. Use

<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "Default. aspx. cs" Inherits = "ui. _ Default"
ValidateRequest = "false" %>

If ValidateRequest is not set to false, an error is reported, indicating a risk exists.

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

Use: <FCKeditorV2: FCKeditor Height = "400px" ID = "FCKeditor1" Width = "800px" runat = "server">
</FCKeditorV2: FCKeditor>

The background FCKeditor1.value. tostring (); can store the content in the database.

After completing the above steps, you can use FCK. If you want to verify the upload and use Chinese characters, you need to modify and set it further.

FCKeditor detailed settings

1. There is a risk of uploading, and verification is added in version 2.63.

D: \ project \ fckeditor \ editor \ filemanager \ connectors \ aspx \ config. ascx

Open Edit

Private bool CheckAuthentication ()
{
Return Session ["UserInfo"] = null? False: true;
// Return true;
}
In this function, perform identity verification and determine whether you have the permission to upload images or flash files.

By default, false is returned. If false is returned, a message is displayed during upload.

"This connector is disabled Please check the" editor/filemanager/connectors/aspx/config. aspx"

2. When the server didn't send back a proper xml... error prompt appears when you Click Browse server in the Upload File window,

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.

However, sometimes there is no error, and a sub-Folder image will be automatically generated under the UploadFiles folder.

3. Set Chinese

In the fckeditor \ fckconfig. js File

FCKConfig. DefaultLanguage = 'en'; change to FCKConfig. DefaultLanguage = 'zh-cn ';

4. Modify the type

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

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

Change 'php' to 'aspx '.

5. Skin

FCKConfig. SkinPath = FCKConfig. BasePath + 'Skins/default/'; default color (yellow)

FCKConfig. SkinPath = FCKConfig. BasePath + 'Skins/office2003/'; and office2003)

FCKConfig. SkinPath = FCKConfig. BasePath + 'Skins/silver/'; Metallic (copper)

6. Font

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

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

7. font size

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;

8. Tools

Many functions are unavailable and can be deleted. In the fckeditor \ fckconfig. js file,

FCKConfig. ToolbarSets ["Default"] = []; left in brackets as needed.


9. When editing the template page, the <HTML> </HTML> <BODY> </BODY> label is automatically removed, and the <P> </P> label is added to you.

FCKConfig. FullPage = false; changed to: FCKConfig. FullPage = true;

If you want to remove the automatically added <P> code, you can set the default value here:

FCKConfig. EnterMode = 'P'; // p | div | br
FCKConfig. ShiftEnterMode = 'br '; // p | div | br
Change
FCKConfig. EnterMode = ''; // p | div | br
FCKConfig. ShiftEnterMode = 'br '; // p | div | br

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.