This project is read-only.

CKEditor - custom browser

Topics: General, Troubleshooting, Writing modules
Apr 22, 2011 at 8:09 AM


  From CKEditor Module, I added two aspx file: ImageBrowser.aspx and LinkBrowser.aspx. Then i added the config setting onto config.js.

    config.filebrowserImageBrowseUrl = CKEDITOR.basePath + "ImageBrowser.aspx";
    config.filebrowserImageWindowWidth = 780;
    config.filebrowserImageWindowHeight = 720;
    config.filebrowserBrowseUrl = CKEDITOR.basePath + "LinkBrowser.aspx";
    config.filebrowserWindowWidth = 500;
    config.filebrowserWindowHeight = 650;

Trying out and hit this error as below: Your guys got any idea how to solve this problem?


Server Error in '/OrchardLocal' Application.

The IControllerFactory 'Orchard.Mvc.OrchardControllerFactory' did not return a controller for the name 'CKEditor'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The IControllerFactory 'Orchard.Mvc.OrchardControllerFactory' did not return a controller for the name 'CKEditor'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[InvalidOperationException: The IControllerFactory 'Orchard.Mvc.OrchardControllerFactory' did not return a controller for the name 'CKEditor'.]
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +423459
   System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +49
   System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +13
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +124
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +98
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +50
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   Orchard.Mvc.Routes.HttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +125
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8862676
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

Apr 25, 2011 at 3:41 AM

Anyone can help or any advice for this?


Apr 25, 2011 at 8:42 AM

I *think* the problem is because you're trying to get MVC to serve up static aspx files; it doesn't work that way (although there might be a way to configure Web.config to allow it, it's not really how you should approach things)

So you need to make a controller, and implement ImageBrowser and LinkBrowser as actions. Did you write those yourself or are they from another implementation or something?

Apr 25, 2011 at 9:08 AM

Those two files are coming from another implementation which also applied to CKEditor as well. Btw they use

Apr 25, 2011 at 9:20 AM

What you really mean when you say "they use ASP.NET" is actually "they use WebForms". MVC uses ASP.NET, it's just the underlying server technology. But what you're trying to do is put .aspx WebForms pages into an MVC project and expecting them to just work. The big problem is that Orchard's Web.config is just missing most of the stuff you'd normally get in a WebForms config. So you need to be implementing a Controller with MVC Views instead; how familiar are you with MVC?

Apr 25, 2011 at 10:07 AM

Yeah, you are correct. They applied it using web form. So where can i put a  new controller for browser aspx file? Shall I put controller file onto CKeditor module as browser .aspx files are under CKeditor module? Do you have any good advice?  i am familiar with web form. Just started for studying MVC project since Orchard project 0.5 version. Still not fully understand the concept as the technical documentation is still not enough briefing under this link: . Not know whether Orchard Team has any plan to publish one book called: Orchard .net MVC and sharing to us completely about Orchard concept, configuration, development, libraries and etc.. Thanks.

Apr 25, 2011 at 11:04 AM

You can add a Controller in a module, and also add a Routes file to customise how URLs are mapped to the controller and its actions. There are plenty of examples of this in Orchard source code; look at Orchard.Core.Routable for instance, to see how slugs are used to display content.

There's already tons of documentation and literature about MVC itself. So you might want to do some reading up on that just to familiarise yourself with those concepts. Orchard adds some new functionality but basically it's still just MVC; Orchard modules are MVC Areas.

I'm sure eventually there will be books on Orchard itself but right now it's early days and things might have changed a lot in 6 months or a year :)

So; with the CKEditor module - yes the place to add controller and routes would be in the module itself. But, what I'd like to try and do is have this feature in the main gallery package.

What I didn't realise until just now, is that usagi made me an owner of the package on Orchard Gallery (he said he was going to do it, but I didn't realise it had already happened). So I'm actually able to put the updated version there once it's ready. I'd also like to upgrade it to the latest CKEditor version.

Unfortunately I don't have any write access to his SVN repository so I'm thinking about starting a new Codeplex project at least for now to hold the repository.

We can then start a fork to work on these integrations and I can help you get everything working. Does that sound good?

Apr 25, 2011 at 12:33 PM

Hi again,

I've set up the project at and updated to CKEditor 3.5.3. There's also a new configuration mechanism using a custom shape, configuration changes should go in Views/CKEditor.Config.cshtml now instead of config.js.

I also created a fork for the browser integration and added you as a collaborator:

So, you can pull a copy of that source using Mercurial, add your files and push them back up to the server; and we'll try and get this working properly! Once it's done I'll pull it over into the main release.

Apr 26, 2011 at 3:49 AM

Hi randompete,

Great to hear about that... Well done. Thanks a lot.