TinyMCE Spellchecker in ASP.NET MVC

I followed the tutorial described here to get TinyMCE Spellchecker to work in a Webforms application. But I tried to do the same in the MVC project and constantly get errors every time I try to use spell checking.

I would like to know what changes or adjustments I need to make to make this word in an ASP.NET MVC project.

The error I am getting is the following:

[HttpException]: The controller for path '/TinyMCE.ashx' could not be found or it does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
+3
source share
2 answers

Well, its a little hard to understand what the problem is, not knowing what kind of error you are getting, but I assume that it is because you need to ignore the spellcheck route in your MVC. Do this by adding something like this to your MVC route definitions:

 //ignore just the TinyMCE spell checker service: routes.IgnoreRoute("TinyMCE.ashx"); //or if you want to be more general & ignore all ashx's: routes.IgnoreRoute("{resource}.ashx{*pathInfo}"); 

Without the above, this will interpret the URL of the spell check request ( TinyMCE.ashx... ) as an MVC route and try to find the appropriate controller (and, obviously, fail).

If this is not a problem, I would suggest posting additional information about the specific error you are seeing.

+5
source

I am new to MVC (a little over a year) and have been quite interested in spell checking for a specific page in my solution. The above options may work for some people, but they didn’t work for me (I’m not very patient and honestly didn’t want to ignore any routes or modified my system.web section of my configuration for something that only 5% of the users of my solution will use, so I did not spend much time on these options).

So:

  • I copied the Moxiecode.TinyMCE.dll file to a directory in my project, so future contributors will have dll without google search.
  • I added a link to the above DLL to my project.
  • I created a new controller called SpellCheckController.cs, which contains the following:

     public void CheckSpelling() { SpellCheckerModule spellChecker = new SpellCheckerModule(); spellChecker.ProcessRequest(System.Web.HttpContext.Current); } 

(don't forget to use Moxiecode.TinyMCE.SpellChecker;)

and just referenced the controller like this in the TinyMCE settings in my opinion:

 spellchecker_rpc_url: "@Url.Action("CheckSpelling","SpellCheck")/?module=SpellChecker" 

I did not ignore any routes. I haven't added yet another httphandler to what I assume is a pretty long list of handlers for .net, and spell checking works for me now.

I also have the opportunity to go with something else without changing too much (assuming I figure out what the TinyMCE validation tool does with the http context.

PS A text editor with a stack overflow does not have a spell check function, so there are no guarantees with the above spelling :)

+4
source

Source: https://habr.com/ru/post/1313864/


All Articles