Configure the FCKeditor Control in Asp.net

Source: Internet
Author: User

Step 1: download and install the software

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

You need to download the FCKeditor. NET and FCKeditor files. FCKeditor. NET is only used to configure FCKeditor in. net, and does not contain any substantive content.

I downloaded the FCKeditor. net_2.6.3 and fckeditor_2.6.5 files.

1.For the fckeditor_2.6.5.zip File

After decompression, copy the obtained FCKeditor folder to the directory of the website.

 

2. For FCKeditor. net_2.6.3

Decompress FCKeditor. net_2.6.3, which contains all the code of FCKeditor. net_2.6.3, but we only need to use the compiled code.

■ Find the fredck. fckeditorv2.dll file in the/bin/release directory. Add fredck. fckeditorv2.dll to the bin directory.

■ Create a new tab named FCKeditor in the toolbox of vs2005/2008, right-click it, select Choose item, and locate decompressed FCKeditor.. fckeditorv2.dll. A FCKeditor. NET component is generated under this tab. Drag and Drop the component to the interface in the design mode of.

Step 2: Configure FCKeditor

Go to the FCKeditor folder and edit the fckconfig. js file as follows:

1. Specify the programming environment of the editor application and 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

2And 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 /';
4In the editor, you can use the tab key. (1 is yes, 0 is no)
Change fckconfig. tabspaces = 0; To fckconfig. tabspaces = 1;
5Add several common font Methods
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'
6Custom Toolbar
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', '-', 'unlink', '-', 'style ', 'fontsize', 'textcolor', 'bgcolor', '-', 'smiley ', 'specialchar', 'replace ', 'preview']
];
7, Configure webconfig

Add the parameter to the <ettings> node as follows:
If you use the default upload function
<Add key = "FCKeditor: basepath" value = "~ /FCKeditor/"/>
<Add key = "FCKeditor: userfilespath" value = "/website name/uploadfiles/"/>

8. If you need to use the image upload function, you need to configure

Editor/filemanager/connectors/aspx/config. ascx modify the checkauthentication () method and return true

Note that the comment here: Do not simply change it to true, but add some permission check checks here. Otherwise, all users can upload images.

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;
}

If this parameter is not modified, a blocking box is displayed, showing "this connector is disabled please check the" Editor/filemanager/connectors/aspx/config. aspx"

9. other secondary configurations (no impact on Use)
* You can delete all examples and source files starting with the "FCKeditor" directory and Its subdirectories.
* You can retain only fckconfig. JS, FCKeditor. JS, and several XML files in the FCKeditor directory, and delete all the other files.
* The editor directory under the FCKeditor directory contains a filemanager directory, which deletes all directories except the aspx directory in the borswer/default/connectors directory.
* You can delete all contents except zh-cn.js, en. js and Zh. js under the editor/lang directory.


Step 3: Use the FCKeditor Editor

Note that the red part is added using FCKeditor:

Autoeventwireup = "true" is to increase the association of some special events.

Validaterequest = "false" is because the content submitted in the FCKeditor box is HTML, so you need to remove the function of verifying the request submission.

<% @ Page Language = "C #" autoeventwireup = "true"

Codefile = "default. aspx. cs" inherits = "_ default" validaterequest = "false" %>

<! 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>

 

Obtain the content filled in the editor in the background: Read the Value Attribute Value of the fckeditor1 control.

 

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.