gpt4 book ai didi

asp.net - Cckfinder azure 以编程方式设置后端

转载 作者:行者123 更新时间:2023-12-02 07:26:46 24 4
gpt4 key购买 nike

我想将 Azure 设置为 CKFinder 的后端,并且我想从 AppSettings 读取值(帐户、密码),而不是后端的 CKFinder 设置。像这样的东西:

    <add key="CKFinderBackendAccountName" value="**********" />
<add key="CKFinderBackendAccountKey" value="************" />

到目前为止,我有此代码,我只想从 APPSettings 读取 Azure 帐户和密码。我在 ConnectorBuilder 中没有看到相应的属性。

connectorBuilder.LoadConfig()
.SetLicense(licenceDomain, licenceKey)
.SetAuthenticator(customAuthenticator)
.SetRequestConfiguration(
(request, config) =>
{
config.LoadConfig();
var defaultBackend = config.GetBackend("azureBackend");}

最佳答案

是的,可以使用config.AddBackend()config.AddResourceType()

var connector = connectorBuilder
.LoadConfig()
.SetRequestConfiguration(
(request, config) =>
{
config.LoadConfig();

string accountName = ConfigurationManager.AppSettings["CKFinderBackendAccountName"];
string accountKey = ConfigurationManager.AppSettings["CKFinderBackendAccountKey"];

// For saving images and files
var azStorage = new AzureStorage(accountName, accountKey, "containername", "rootname");
config.AddBackend("azstore", azStorage, baseUrl: "https://storageaccountname.blob.core.windows.net/ckfinderstuff", isProxy: false);
config.AddResourceType("Images", resourceBuilder => resourceBuilder.SetBackend("azstore", "images").SetAllowedExtensions("bmp", "gif", "jpeg", "jpg", "png"));
config.AddResourceType("Files", resourceBuilder => resourceBuilder.SetBackend("azstore", "files").SetAllowedExtensions("7z", "aiff", "asf", "avi", "bmp", "csv", "doc", "docx", "fla", "flv", "gif", "gz", "gzip", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "ods", "odt", "pdf", "png", "ppt", "pptx", "pxd", "qt", "ram", "rar", "rm", "rmi", "rmvb", "rtf", "sdc", "sitd", "swf", "sxc", "sxw", "tar", "tgz", "tif", "tiff", "txt", "vsd", "wav", "wma", "wmv", "xls", "xlsx", "zip"));
})
.SetAuthenticator(customAuthenticator)
.Build(connectorFactory);

您需要确保删除 web.configckfinder 部分下的 backendresourceTypes 节点>

关于此的文档不​​多,因此我必须自己解决大部分内容,但您可以查看此处的文档是否有帮助

https://ckeditor.com/docs/ckfinder/ckfinder3-net/configuration_by_code.html

关于asp.net - Cckfinder azure 以编程方式设置后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51608319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com