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" />