Objective
Configuring the. NET Mvc4 Project uses the Ueditor Editor to document the solution by encountering several issues during configuration. The editor can download the. NET Development package to Http://ueditor.baidu.com/website/download.html#ueditor, for example, I downloaded the 1.2.6.1net version of the development package.
Configuration:
1, put the development package into the MVC4 project, in my project I put in the content directory
2. Introduce JS and style files in the template page:
3, in the page configuration initialization editor, in the page configuration textarea display as editor, the editor more parameter settings can refer to ueditor.config.js inside the configuration instructions:
@using (Html.BeginForm ()) {<textareaID= "Editor"name= "Editor"></textarea> <inputtype= "Submit"value= "Submit" />} @section scripts{<Scripttype= "Text/javascript"> varEditor= NewBaidu.editor.ui.Editor ({ueditor_home_url:'/content/ueditor/',//Configure editor PathIframecssurl:'/content/ueditor/themes/iframe.css',//Style pathinitialcontent:'Welcome to use Ueditor',//Initializing editor Contentautoheightenabled:true,//High automatic growthMinframeheight: -//min. height }); Editor.render ('Editor'); </Script> }
By this point, the page has already shown the editor's appearance,
4, to solve the picture upload problem, by viewing the Ueditor configuration file and imageup.ashx it is obvious that the editor will put the picture into the Uditor/net/upload or Upload1 folder, if not exist, create a folder, The upload image will be prompted with a network connection error, viewing the error via F12
View the default properties of the uploader file to compile, change its properties to content after re-running the program, the picture uploaded successfully, such as:
5. Troubleshoot form submission errors, starting with the. Net Framework 4.0, ASP. NET starts to force detection of the request parameter security , the following error occurs when the direct commit
This issue is resolved in the background action tag [ValidateInput (false)],
6, editor and other content we can receive through formcollection, so as to achieve content preservation, processing pictures and other related operations
The above is the Baidu editor in the MVC project of the simple configuration, personal feeling is still very useful, has been used in a number of projects, no feeling like a lot of people say that not so good, but the individual feels nice.
Baidu Rich Text editor Ueditor