From bb3a9c0e2ece4e1a2ec8669653fc6a4b019856c2 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 23 Nov 2015 15:19:13 +0100 Subject: [PATCH] Fixes: U4-7394 Missing maxFilseSize variable from web.config in the backoffice --- src/Umbraco.Web/Editors/BackOfficeController.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 4780d1e768..e9e9bcb36e 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; +using System.Web.Configuration; using System.Web.Mvc; using System.Web.UI; using ClientDependency.Core.Config; @@ -177,6 +179,13 @@ namespace Umbraco.Web.Editors return new JsonNetResult { Data = gridConfig.EditorsConfig.Editors, Formatting = Formatting.Indented }; } + private string GetMaxRequestLength() + { + var section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; + if (section == null) return string.Empty; + return section.MaxRequestLength.ToString(); + } + /// /// Returns the JavaScript object representing the static server variables javascript object /// @@ -340,6 +349,10 @@ namespace Umbraco.Web.Editors "imageFileTypes", string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes) }, + { + "maxFileSize", + GetMaxRequestLength() + }, {"keepUserLoggedIn", UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn}, {"cssPath", IOHelper.ResolveUrl(SystemDirectories.Css).TrimEnd('/')}, }