1

I'm using CKFinder 3.3 in a CMS that is running under a separate ASP .Net Application from the main website (/__admin has its own application). The website is an WebForms application.

The problem is the CKFinder connector points to /ckfinder/connector instead of what I have setup. Obviously I get an IIS 404 response, since this path is not configured to anything in the root application.

web.config

  <appSettings>
    <add key="ckfinderRoute" value="/connector" />

and ckeditor is used like

CKEDITOR.replace('ctl00_cphMain_fvItem_tbContent_Input',
   {
 filebrowserBrowseUrl: '/__admin/CKFinderScripts/ckfinder.html?=635999758837233543',
 filebrowserImageBrowseUrl: '/__admin/CKFinderScripts/ckfinder.html?type=Images&a=635999758837233543',
 filebrowserUploadUrl: '/__admin/connector?command=QuickUpload&type=Files',
 filebrowserImageUploadUrl: '/__admin/connector?command=QuickUpload&type=Images'                     
            });
CKEDITOR.timestamp='635999758837233543';

The same setup is working correctly when running under the Visual Studio's host (Ctrl + F5). Worth to mention that in a MVC application, with the same setup, this is working correctly. CKFinder is configured via its own section in web.config and not from code, via the OWIN Startup class. When I tried that (Map(route, connectorSetup)) I got the same results.

As temp fix I added the following rewrite rule in the website root.

<rule name="connector">
          <match url="^ckfinder/connector"/>
          <action type="Rewrite" url="/__admin/connector"/>
</rule>

Edit:

I changed how I setup the connector. I'm doing it now via Startup class so I can control how the ckfinderRoute is set. It looks like

public void Configuration(IAppBuilder builder)
        {
            LoggerManager.LoggerAdapterFactory = new NLogLoggerAdapterFactory();

            RegisterFileSystems();

            var route = ConfigurationManager.AppSettings["ckfinderRoute"];
            builder.Map(route, SetupConnector);
        }

The SetupConnector method is loading the settings from web.config and adds the authentication. I think is irrelevant to show the code here.

I'm listing the related packages too

 <package id="CKSource.CKFinder" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.CKFinder.Connector.Config" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.CKFinder.Connector.Core" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.CKFinder.Connector.Host.Owin" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.CKFinder.Connector.KeyValue.EntityFramework" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.CKFinder.Connector.Logs.NLog" version="3.3.0" targetFramework="net461" />
  <package id="CKSource.FileSystem" version="1.0.0" targetFramework="net461" />
  <package id="CKSource.FileSystem.Amazon" version="1.0.0" targetFramework="net461" />
  <package id="CKSource.FileSystem.Local" version="1.0.0" targetFramework="net461" />

the issue in its action

Adrian Iftode
  • 15,465
  • 4
  • 48
  • 73
  • 1
    Are you doing the integration with sample WebApp or are you using NuGet packages? There are slight differences between these two in route mapping. It looks like you're mixing both setups. – kfazi Jun 01 '16 at 09:41
  • With NuGet in a legacy application. – Adrian Iftode Jun 01 '16 at 10:03
  • Basically /__admin/CKFinderScripts/ckfinder.html page is using /ckfinder/connector instead of /__admin/connector – Adrian Iftode Jun 01 '16 at 10:05

1 Answers1

3

You can tell the javascript client to use custom connector path in your CKFinderScripts/config.js file:

config.connectorPath = '/__admin/connector';

You can find more configuration options in the documentation.

kfazi
  • 617
  • 1
  • 9
  • 21
  • It doesn't fix. To make I don't get a cached copy I'm using those timestamps too. – Adrian Iftode Jun 01 '16 at 12:26
  • Better make sure your cache is clear. `config.js` is requested from within `ckfinder.js` (which is requested by `CKFinderScripts/ckfinder.html`) and it doesn't use your timestamp query parameter. – kfazi Jun 01 '16 at 12:39
  • OK. I'll give a try. Keep in mind the important detail. The CKFinder setup is made in /__admin/ which is a separate Web Application Project. Your answer works when CKFinder has a setup in the root application. – Adrian Iftode Jun 01 '16 at 12:44
  • 1
    You're right. Was a cache issue. I made some many wrong assumptions. The problem is I can't ask the customers to clear their cache, so I'll probably use that rewrite. http://superuser.com/questions/721692/google-chrome-clear-cache-for-specific-website – Adrian Iftode Jun 01 '16 at 12:48
  • @AdrianIftode Maybe a very long response but you could add cache busting parameter when setting up CKEdtior: `CKFinder.setupCKEditor( editor, { configPath: 'config.js?cache=MYCACHEVALUE' } ); ` – jodator Aug 08 '16 at 13:08
  • @jodator I know about config.js, but the issue here was with the connector – Adrian Iftode Aug 08 '16 at 13:42