Use the Web editing Control FCKeditor in Asp.net

Source: Internet
Author: User

Download two files:
FCKeditor (JS file), fckedito.net (COM + component DLL file)
Official Website: Http://sourceforge.net
Fckediotr installation and configuration:
Decompress the fckediotr file package to the root directory of the project, and a FCKeditor folder is displayed under the root directory, which contains all the core files of FCKeditor.
Then, add the DLL file in the FCKeditor. Net folder to the vs toolbox. In this way, a bin folder will be added under the root directory of the project, and the Freck. fckeditorv2.dll file will be added.
In this way, the installation is complete, and some attributes must be configured below to make the control work properly:
Configuration of FCKeditor in ASP. net2.0 web project:
Drag the FCKeditor Control from the toolbox and you will be able to see the FCKeditor on the default page. However, you can only see the position frame of the FCKeditor and will not see the running effect, on the property panel, you can set some basic attributes of this FCKeditor object. The more important thing is the basepath attribute. If FCKeditor was previously set to FCKeditor in the root directory, it would be ~ /FCKeditor/. If it is another directory name, replace it with the corresponding value (Note: The default value of the control is/FCKeditor /, because the runat = "server" attribute is set for the server control, you must explicitly declare basepath = "~ /FCKeditor /"). Switch default. aspxSource code Mode (source), we can see Code :
<% @ Register Assembly = "fredck. fckeditorv2" namespace = "fredck. fckeditorv2" tagprefix = "fckeditorv2" %>
<Fckeditorv2: FCKeditor id = "fckeditor1" runat = "server"> </fckeditorv2: FCKeditor>
For this example, the configuration code is as follows:
<Fckeditorv2: FCKeditor
Id = "fckeditor1"
Runat = "server"
Autodetectlanguage = "false"
Defaultlanguage = "ZH-CN"
Basepath = "~ /FCKeditor/">
</Fckeditorv2: FCKeditor>
At this point, the configuration of FCKeditor is not actually completed, because it contains a powerful feature we have not configured correctly: file upload.
In default. in aspx running mode, click the "insert/edit image" (or flash) function of FCKeditor. In the pop-up box, click "Browse server" and a dialog box appears, the following error message is displayed: XML request error: forbidden (403 ).
If you get such errors, web development experience knows that 403 should be a read/write permission problem. But why? The reason is that the userfiles path is not configured.
Create an empty directory named files in the root directory of fckpro. The common practice of setting basepath together with basepath is as follows:
Open the Web. config file of the project and modify the deleettings element. The configuration is as follows:
<Deleetask>
<Add key = "FCKeditor: basepath" value = "~ /FCKeditor/"/>
<Add key = "FCKeditor: userfilespath" value = "/project folder name/Files"/>
</Appsettings>
After FCKeditor: basepath is set, you no longer need to specify the basepath attribute every time you use the FCKeditor instance. FCKeditor: userfilespath is the directory where all uploaded files are located. Be sure to set it to/fckpro/files instead ~ /Files, because FCKeditor uses this value to return the relative path of the uploaded file to the client ,~ /Files can be compiled and interpreted by ASP. NET in the service, but the static files on the client do not understand what this is. If you use ~ /Files, the returned paths of all uploaded files are ~ /Files, you will get such a link Http ://~ /Files/image/logo.gif The path is found. So we need to set it like above. This is in the development phase. If the project is released after completion, remember to change/fckpro/files to/files, in the development phase, the URL of vs2005 when running the project is Http: // localhost/ Project name/format. After the project is published, a site is created on the server. Http://www.abc.com/ So it must be changed after the release. These are common errors that occur when fckeditor2.2 + ASP. net2.0 is used, and the cloud is unknown.
So far, the upload function is still the most critical step. Find fckconfig in the root directory of FCKeditor (project file name/FCKeditor. open the JS file in a text editor. Find it in about 132 lines (probably because you may have changed the file by referring to other materials:

VaR _ filebrowserlanguage = 'asp '; // ASP | aspx | CFM | lasso | Perl | PHP | py
VaR _ quickuploadlanguage = 'asp '; // ASP | aspx | CFM | lasso | PHP

Change the value of the values of the two row assignment codes from ASP to aspx and save and close the file. This completes the basic functions.

solutions to XML request error: internal server error (500) Errors During file upload in development.
because ASP. net2.0 has the theme function, if you use stylesheettheme or theme for Web. config in your project, you need to modify it more.
go to the directory where FCKeditor is located and open \ editor \ filemanager \ upload \ aspx \ upload. aspx and \ editor \ filemanager \ browser \ Default \ connectors \ aspx \ connector. aspx files: Add theme = "" Or stylesheettheme = "" to the page tab to modify theme when you are using the project. The modification is as follows:
<% @ page Language = "C #" inherits = "fredck. fckeditorv2.uploader "autoeventwireup =" false "theme =" "%>
or
<% @ page Language =" C # "inherits =" fredck. fckeditorv2.uploader "autoeventwireup =" false "stylesheettheme =" "%>
the internal Error 500 is fixed.

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.