From 81570fab35bf93d698a14045f55101b2d72e66a5 Mon Sep 17 00:00:00 2001
From: Andrea Piovanelli <83577153+AndreaPiovanelli@users.noreply.github.com>
Date: Tue, 29 Oct 2024 09:14:13 +0100
Subject: [PATCH 1/9] Internal page links validation for LinkField (#8805)

* Added page internal references management in LinkField valid urls (e.g. field.Value = "#someId")

* Code refactoring to check LinkField value.
---
 .../Orchard.Fields/Drivers/LinkFieldDriver.cs | 29 +++++++++++++++++--
 .../EditorTemplates/Fields/Link.Edit.cshtml   |  2 +-
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
index 3f314311c..48dbf43ca 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
@@ -6,6 +6,7 @@ using Orchard.Fields.Settings;
 using Orchard.Localization;
 using System;
 using System.Collections.Generic;
+using System.Security.Policy;
 
 namespace Orchard.Fields.Drivers {
     public class LinkFieldDriver : ContentFieldDriver<LinkField> {
@@ -57,11 +58,33 @@ namespace Orchard.Fields.Drivers {
                 if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
                     updater.AddModelError(GetPrefix(field, part), T("Url is required for {0}", T(field.DisplayName)));
                 }
-                else if (!String.IsNullOrWhiteSpace(field.Value) && !Uri.IsWellFormedUriString(field.Value, UriKind.RelativeOrAbsolute)) {
-                    updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
-                }
                 else if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) {
                     updater.AddModelError(GetPrefix(field, part), T("Text is required for {0}.", T(field.DisplayName)));
+                } else if (!String.IsNullOrWhiteSpace(field.Value)) {
+                    // Check if it's a valid uri, considering that there may be the link to an anchor only
+                    // e.g.: field.Value = "#divId"
+                    // Take everything before the first "#" character and check if it's a valid uri.
+                    // If there is no character before the first "#", consider the value as a valid one (because it is a reference to a div inside the same page)
+                    if (field.Value.StartsWith("#")) {
+                        // The field value is a tag id reference
+                        // For html 5, a tag id is valid as long as it doesn't contain white spaces
+                        if (field.Value.IndexOf(' ') >= 0) {
+                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
+                        }
+                    } else {
+                        var urlAndRef = field.Value.Split(new char[] { '#' }, 2);
+
+                        // Since field value is a proper url and not a tag id only, assume the first part of the array is the actual url to link to
+                        if (!String.IsNullOrWhiteSpace(urlAndRef[0]) && !Uri.IsWellFormedUriString(urlAndRef[0], UriKind.RelativeOrAbsolute)) {
+                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
+                        } else if (urlAndRef.Length > 1) {
+                            // The second part of the url is the id reference
+                            // For html 5, a tag id is valid as long as it doesn't contain white spaces
+                            if (urlAndRef[1].IndexOf(' ') >= 0) {
+                                updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
+                            }
+                        }
+                    }
                 }
             }
 
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml
index 89bcbfdbf..c35df6491 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml
@@ -25,7 +25,7 @@
     </div>
     <div class="editor-field">
         @(settings.Required ? Html.TextBoxFor(m => m.Value, new { @class = "text large", required = "required" }) : Html.TextBoxFor(m => m.Value, new { @class = "text large" }))
-        <span class="hint">@T("A valid url, i.e. http://orchardproject.net, /content/file.pdf, ...")</span>
+        <span class="hint">@T("A valid url, i.e. http://orchardproject.net, /content/file.pdf, #some_id, ...")</span>
     </div>
     @if (settings.LinkTextMode == LinkTextMode.Optional || settings.LinkTextMode == LinkTextMode.Required) {
         <div class="editor-label">

From 8425b4ad765804495c010e65aa372c3b2ce6048d Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Fri, 6 Dec 2024 09:49:45 +0100
Subject: [PATCH 2/9] #8811: Update vulnerable NuGet packages and consolidate
 them (#8812)

* Updating System.IdentityModel.Tokens.Jwt and its dependencies in Orchard.Azure.MediaServices

* Using System.IO.Compression instead of DotNetZip

* Upgrading Newtonsoft.Json from 12.0.3 (vulnerable) to 13.0.3

* Updating ModuleRootWebConfig.txt codegen template according to the new Newtonsoft.Json version
---
 CREDITS.txt                                   |  6 ---
 src/Orchard.Core.Tests/App.config             |  2 +-
 src/Orchard.Specs/App.Config                  |  2 +-
 src/Orchard.Tests.Modules/App.config          |  2 +-
 .../Media/Services/MediaServiceTests.cs       | 41 ++++++++++---------
 .../Orchard.Tests.Modules.csproj              |  8 ++--
 src/Orchard.Tests.Modules/packages.config     |  3 +-
 src/Orchard.Tests/App.config                  |  2 +-
 .../Orchard.Framework.Tests.csproj            |  4 +-
 src/Orchard.Tests/packages.config             |  2 +-
 src/Orchard.Web.Tests/app.config              |  2 +-
 src/Orchard.Web/Core/Web.config               |  2 +-
 src/Orchard.Web/Modules/Lucene/Web.config     |  2 +-
 src/Orchard.Web/Modules/Markdown/Web.config   |  2 +-
 .../Modules/Orchard.Alias/Web.config          |  2 +-
 .../Orchard.AntiSpam/Orchard.AntiSpam.csproj  |  6 +--
 .../Modules/Orchard.AntiSpam/Web.config       |  2 +-
 .../Modules/Orchard.AntiSpam/packages.config  |  4 +-
 .../Modules/Orchard.ArchiveLater/Web.config   |  2 +-
 .../Orchard.AuditTrail.csproj                 |  4 +-
 .../Modules/Orchard.AuditTrail/Web.config     |  2 +-
 .../Orchard.AuditTrail/packages.config        |  4 +-
 .../Modules/Orchard.Autoroute/Web.config      |  2 +-
 .../Orchard.Azure.MediaServices.csproj        | 20 ++++-----
 .../Orchard.Azure.MediaServices/Web.config    |  2 +-
 .../packages.config                           | 10 ++---
 .../Orchard.Azure/Orchard.Azure.csproj        |  6 +--
 .../Modules/Orchard.Azure/Web.config          |  2 +-
 .../Modules/Orchard.Azure/packages.config     |  4 +-
 .../Modules/Orchard.Blogs/Web.config          |  2 +-
 .../Modules/Orchard.Caching/Web.config        |  2 +-
 .../ModuleRootWebConfig.txt                   |  2 +-
 .../Modules/Orchard.CodeGeneration/Web.config |  2 +-
 .../Modules/Orchard.Comments/Web.config       |  2 +-
 .../Modules/Orchard.Conditions/Web.config     |  2 +-
 .../Orchard.ContentPermissions/Web.config     |  2 +-
 .../Modules/Orchard.ContentPicker/Web.config  |  2 +-
 .../Modules/Orchard.ContentTypes/Web.config   |  2 +-
 .../Modules/Orchard.CustomForms/Web.config    |  2 +-
 .../Modules/Orchard.Dashboards/Web.config     |  2 +-
 .../Modules/Orchard.DesignerTools/Web.config  |  2 +-
 .../Orchard.DynamicForms.csproj               |  4 +-
 .../Modules/Orchard.DynamicForms/Web.config   |  2 +-
 .../Orchard.DynamicForms/packages.config      |  2 +-
 .../Orchard.Email/Orchard.Email.csproj        |  4 +-
 .../Modules/Orchard.Email/Web.config          |  2 +-
 .../Modules/Orchard.Email/packages.config     |  2 +-
 .../Modules/Orchard.Fields/Web.config         |  2 +-
 .../Orchard.Forms/Orchard.Forms.csproj        |  6 +--
 .../Modules/Orchard.Forms/Web.config          |  2 +-
 .../Modules/Orchard.Forms/packages.config     |  4 +-
 .../Modules/Orchard.ImageEditor/Web.config    |  2 +-
 .../Modules/Orchard.ImportExport/Web.config   |  2 +-
 .../Modules/Orchard.Indexing/Web.config       |  2 +-
 .../Orchard.JobsQueue.csproj                  |  6 +--
 .../Modules/Orchard.JobsQueue/Web.config      |  2 +-
 .../Modules/Orchard.JobsQueue/packages.config |  4 +-
 .../Orchard.Layouts/Orchard.Layouts.csproj    |  4 +-
 .../Modules/Orchard.Layouts/Web.config        |  2 +-
 .../Modules/Orchard.Layouts/packages.config   |  2 +-
 .../Modules/Orchard.Lists/Web.config          |  2 +-
 .../Modules/Orchard.Localization/Web.config   |  2 +-
 .../Orchard.Media/Orchard.Media.csproj        |  6 +--
 .../Orchard.Media/Services/MediaService.cs    | 32 +++++++--------
 .../Modules/Orchard.Media/Web.config          |  2 +-
 .../Modules/Orchard.Media/packages.config     |  1 -
 .../Orchard.MediaLibrary.csproj               |  6 +--
 .../Modules/Orchard.MediaLibrary/Web.config   |  2 +-
 .../Orchard.MediaLibrary/packages.config      |  4 +-
 .../Modules/Orchard.MediaPicker/Web.config    |  2 +-
 .../Orchard.MediaProcessing/Web.config        |  2 +-
 .../Modules/Orchard.MessageBus/Web.config     |  2 +-
 .../Modules/Orchard.Migrations/Web.config     |  2 +-
 .../Modules/Orchard.Modules/Web.config        |  2 +-
 .../Modules/Orchard.MultiTenancy/Web.config   |  2 +-
 .../Modules/Orchard.OutputCache/Web.config    |  2 +-
 .../Modules/Orchard.Packaging/Web.config      |  2 +-
 .../Modules/Orchard.Pages/Web.config          |  2 +-
 .../Orchard.Projections/Tests/app.config      |  2 +-
 .../Modules/Orchard.Projections/Web.config    |  2 +-
 .../Modules/Orchard.PublishLater/Web.config   |  2 +-
 .../Modules/Orchard.Recipes/Web.config        |  2 +-
 .../Orchard.Redis/Orchard.Redis.csproj        |  6 +--
 .../Modules/Orchard.Redis/Web.config          |  2 +-
 .../Modules/Orchard.Redis/packages.config     |  4 +-
 .../Modules/Orchard.Resources/Web.config      |  2 +-
 .../Modules/Orchard.Roles/Web.config          |  2 +-
 .../Modules/Orchard.Rules/Web.config          |  2 +-
 .../Orchard.Scripting.CSharp/Web.config       |  2 +-
 .../Modules/Orchard.Scripting.Dlr/Web.config  |  2 +-
 .../Modules/Orchard.Scripting/Web.config      |  2 +-
 .../Modules/Orchard.Search/Web.config         |  2 +-
 .../Orchard.SecureSocketsLayer/Web.config     |  2 +-
 .../Modules/Orchard.Setup/Web.config          |  2 +-
 .../Modules/Orchard.Tags/Web.config           |  2 +-
 .../Modules/Orchard.TaskLease/Web.config      |  2 +-
 .../Orchard.Taxonomies.csproj                 |  6 +--
 .../Modules/Orchard.Taxonomies/Web.config     |  2 +-
 .../Orchard.Taxonomies/packages.config        |  4 +-
 .../Modules/Orchard.Templates/Web.config      |  2 +-
 .../Modules/Orchard.Themes/Web.config         |  2 +-
 .../Modules/Orchard.Tokens/Tests/app.config   |  2 +-
 .../Modules/Orchard.Tokens/Web.config         |  2 +-
 .../Modules/Orchard.Users/Web.config          |  2 +-
 .../Modules/Orchard.Warmup/Web.config         |  2 +-
 .../Modules/Orchard.Widgets/Web.config        |  2 +-
 .../Orchard.Workflows.csproj                  |  6 +--
 .../Modules/Orchard.Workflows/Web.config      |  2 +-
 .../Modules/Orchard.Workflows/packages.config |  4 +-
 .../Modules/Orchard.jQuery/Web.config         |  2 +-
 src/Orchard.Web/Modules/SysCache/Web.config   |  2 +-
 src/Orchard.Web/Modules/TinyMce/Web.config    |  2 +-
 .../Modules/Upgrade/Upgrade.csproj            |  4 +-
 src/Orchard.Web/Modules/Upgrade/Web.config    |  2 +-
 .../Modules/Upgrade/packages.config           |  4 +-
 src/Orchard.Web/Orchard.Web.csproj            |  4 +-
 src/Orchard.Web/Themes/Web.config             |  2 +-
 src/Orchard.Web/Web.config                    |  2 +-
 src/Orchard.Web/packages.config               |  2 +-
 src/Orchard/Orchard.Framework.csproj          |  4 +-
 src/Orchard/app.config                        |  2 +-
 src/Orchard/packages.config                   |  2 +-
 122 files changed, 204 insertions(+), 217 deletions(-)

diff --git a/CREDITS.txt b/CREDITS.txt
index f45a44093..35b9411f1 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -52,12 +52,6 @@ Website:      http://dlr.codeplex.com
 Copyright:    Copyright (c) Microsoft Corporation
 License:      Apache Software Foundation License 2.0
 
-DotNetZip
------
-Website:      http://dotnetzip.codeplex.com/
-Copyright:    
-License:      MS-PL
-
 Eric Meyer's Reset CSS
 -----
 Website:      http://meyerweb.com/eric/tools/css/reset/
diff --git a/src/Orchard.Core.Tests/App.config b/src/Orchard.Core.Tests/App.config
index 9493cfeea..6ada2cd01 100644
--- a/src/Orchard.Core.Tests/App.config
+++ b/src/Orchard.Core.Tests/App.config
@@ -16,7 +16,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Specs/App.Config b/src/Orchard.Specs/App.Config
index ac77472da..417d4df69 100644
--- a/src/Orchard.Specs/App.Config
+++ b/src/Orchard.Specs/App.Config
@@ -24,7 +24,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Tests.Modules/App.config b/src/Orchard.Tests.Modules/App.config
index a5baeb2d4..4a4387430 100644
--- a/src/Orchard.Tests.Modules/App.config
+++ b/src/Orchard.Tests.Modules/App.config
@@ -24,7 +24,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" />
diff --git a/src/Orchard.Tests.Modules/Media/Services/MediaServiceTests.cs b/src/Orchard.Tests.Modules/Media/Services/MediaServiceTests.cs
index 018772b6f..e349829dd 100644
--- a/src/Orchard.Tests.Modules/Media/Services/MediaServiceTests.cs
+++ b/src/Orchard.Tests.Modules/Media/Services/MediaServiceTests.cs
@@ -1,8 +1,8 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.IO.Compression;
 using System.Linq;
-using Ionic.Zip;
 using NUnit.Framework;
 using Orchard.Environment.Configuration;
 using Orchard.FileSystems.Media;
@@ -53,10 +53,10 @@ namespace Orchard.Tests.Modules.Media.Services {
         [Test]
         public void GetMediaFoldersTest() {
             StorageProvider.ListFoldersPredicate = path => {
-                return string.IsNullOrEmpty(path) ? new[] {new StubStorageFolder(FolderName1)}
-                            : string.Equals(path, FolderName1) ? new[] {new StubStorageFolder(FolderName2), new StubStorageFolder(FolderName3)}
+                return string.IsNullOrEmpty(path) ? new[] { new StubStorageFolder(FolderName1) }
+                            : string.Equals(path, FolderName1) ? new[] { new StubStorageFolder(FolderName2), new StubStorageFolder(FolderName3) }
                                  : new StubStorageFolder[] { };
-                };
+            };
 
             IEnumerable<MediaFolder> mediaFolders = MediaService.GetMediaFolders(null);
             Assert.That(mediaFolders.Count(), Is.EqualTo(1), "Root path only has 1 sub directory");
@@ -94,7 +94,7 @@ namespace Orchard.Tests.Modules.Media.Services {
             Assert.That(StorageProvider.SavedStreams.Contains(StorageProvider.Combine(FolderName1, FinalDottedWebconfigFileName)), Is.False, "no extension files are never allowed");
             Assert.That(StorageProvider.SavedStreams.Contains(StorageProvider.Combine(FolderName1, PaddedWebconfigFileName)), Is.False, "no extension files are never allowed");
             Assert.That(StorageProvider.SavedStreams.Contains(StorageProvider.Combine(FolderName1, FinalDottedTextFileName)), Is.False, "no extension files are never allowed");
-            
+
             Assert.That(StorageProvider.SavedStreams.Count, Is.EqualTo(3));
         }
 
@@ -160,29 +160,30 @@ namespace Orchard.Tests.Modules.Media.Services {
         }
 
         private MemoryStream CreateZipMemoryStream() {
+            var entries = new List<string> {
+                TextFileName, WebconfigFileName, DllFileName, ZipFileName, NoExtensionFileName, PaddedWebconfigFileName,
+                FinalDottedWebconfigFileName, PaddedTextFileName, FinalDottedTextFileName
+            };
+
             // Setup memory stream with zip archive for more complex scenarios
             MemoryStream memoryStream = new MemoryStream();
-            using (ZipFile zipOut = new ZipFile()) {
-
-                zipOut.AddEntry(TextFileName, new byte[] { 0x01 });
-                zipOut.AddEntry(WebconfigFileName, new byte[] { 0x02 });
-                zipOut.AddEntry(DllFileName, new byte[] { 0x03 });
-                zipOut.AddEntry(ZipFileName, new byte[] { 0x04 });
-                zipOut.AddEntry(NoExtensionFileName, new byte[] { 0x05 });
-                zipOut.AddEntry(PaddedWebconfigFileName, new byte[] { 0x06 });
-                zipOut.AddEntry(FinalDottedWebconfigFileName, new byte[] { 0x07 });
-                zipOut.AddEntry(PaddedTextFileName, new byte[] { 0x08 });
-                zipOut.AddEntry(FinalDottedTextFileName, new byte[] { 0x09 });
-
-                zipOut.Save(memoryStream);
+            using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, leaveOpen: true)) {
+                var content = new byte[] { 0x01 };
+                foreach (var entry in entries) {
+                    var zipEntry = archive.CreateEntry(entry);
+                    using (var zipStream = zipEntry.Open()) {
+                        zipStream.Write(content, 0, 1);
+                    }
+                    ++content[0];
+                }
             }
-                
+
             return new MemoryStream(memoryStream.ToArray());
         }
 
         private class MediaServiceAccessor : MediaService {
             public MediaServiceAccessor(IStorageProvider storageProvider, IOrchardServices orchardServices)
-                : base (storageProvider, orchardServices) {}
+                : base(storageProvider, orchardServices) { }
 
             public void UnzipMediaFileArchiveAccessor(string targetFolder, Stream zipStream) {
                 UnzipMediaFileArchive(targetFolder, zipStream);
diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
index 0667d1d7c..f02dacad9 100644
--- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
+++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
@@ -64,9 +64,6 @@
     <Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
       <HintPath>..\packages\Castle.Core.3.3.1\lib\net45\Castle.Core.dll</HintPath>
     </Reference>
-    <Reference Include="DotNetZip, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
-      <HintPath>..\packages\DotNetZip.1.12.0\lib\net20\DotNetZip.dll</HintPath>
-    </Reference>
     <Reference Include="FluentNHibernate, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
     </Reference>
@@ -107,8 +104,8 @@
     <Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
       <HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
@@ -134,6 +131,7 @@
       <HintPath>..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="System.IO.Compression" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Abstractions">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
diff --git a/src/Orchard.Tests.Modules/packages.config b/src/Orchard.Tests.Modules/packages.config
index 7ee686fd9..8aa1a29ec 100644
--- a/src/Orchard.Tests.Modules/packages.config
+++ b/src/Orchard.Tests.Modules/packages.config
@@ -2,7 +2,6 @@
 <packages>
   <package id="Autofac" version="3.5.2" targetFramework="net48" />
   <package id="Castle.Core" version="3.3.1" targetFramework="net48" />
-  <package id="DotNetZip" version="1.12.0" targetFramework="net48" />
   <package id="FluentNHibernate" version="2.0.3.0" targetFramework="net48" />
   <package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net48" />
   <package id="IronRuby" version="1.1.3" targetFramework="net48" />
@@ -12,7 +11,7 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
   <package id="Orchard.FluentPath" version="1.0.0.1" targetFramework="net48" />
diff --git a/src/Orchard.Tests/App.config b/src/Orchard.Tests/App.config
index a5baeb2d4..4a4387430 100644
--- a/src/Orchard.Tests/App.config
+++ b/src/Orchard.Tests/App.config
@@ -24,7 +24,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" />
diff --git a/src/Orchard.Tests/Orchard.Framework.Tests.csproj b/src/Orchard.Tests/Orchard.Framework.Tests.csproj
index a4cb85c8a..dbf74d029 100644
--- a/src/Orchard.Tests/Orchard.Framework.Tests.csproj
+++ b/src/Orchard.Tests/Orchard.Framework.Tests.csproj
@@ -104,8 +104,8 @@
     <Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
       <HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
diff --git a/src/Orchard.Tests/packages.config b/src/Orchard.Tests/packages.config
index 56276c608..f6113f41e 100644
--- a/src/Orchard.Tests/packages.config
+++ b/src/Orchard.Tests/packages.config
@@ -14,7 +14,7 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
   <package id="NUnitTestAdapter" version="2.3.0" targetFramework="net48" />
diff --git a/src/Orchard.Web.Tests/app.config b/src/Orchard.Web.Tests/app.config
index 35fa94aea..37b4df731 100644
--- a/src/Orchard.Web.Tests/app.config
+++ b/src/Orchard.Web.Tests/app.config
@@ -16,7 +16,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Web/Core/Web.config b/src/Orchard.Web/Core/Web.config
index b4eb81357..29f42ce2e 100644
--- a/src/Orchard.Web/Core/Web.config
+++ b/src/Orchard.Web/Core/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Lucene/Web.config b/src/Orchard.Web/Modules/Lucene/Web.config
index 5d7a337e5..d7b3d6256 100644
--- a/src/Orchard.Web/Modules/Lucene/Web.config
+++ b/src/Orchard.Web/Modules/Lucene/Web.config
@@ -53,7 +53,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Markdown/Web.config b/src/Orchard.Web/Modules/Markdown/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Markdown/Web.config
+++ b/src/Orchard.Web/Modules/Markdown/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Web.config b/src/Orchard.Web/Modules/Orchard.Alias/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Alias/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Alias/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj b/src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj
index 19ce10a60..56a43eda4 100644
--- a/src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj
+++ b/src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj
@@ -59,8 +59,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
@@ -250,4 +250,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.AntiSpam/Web.config b/src/Orchard.Web/Modules/Orchard.AntiSpam/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.AntiSpam/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.AntiSpam/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.AntiSpam/packages.config b/src/Orchard.Web/Modules/Orchard.AntiSpam/packages.config
index 3a05f90ac..4edd53141 100644
--- a/src/Orchard.Web/Modules/Orchard.AntiSpam/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.AntiSpam/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Web.config b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj b/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj
index 21115cd73..e0098aa0e 100644
--- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj
+++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Orchard.AuditTrail.csproj
@@ -61,8 +61,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Web.config b/src/Orchard.Web/Modules/Orchard.AuditTrail/Web.config
index bdc46ecc9..30fb3794f 100644
--- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Web.config
@@ -56,7 +56,7 @@
             </dependentAssembly>
             <dependentAssembly>
                  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                 <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                 <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
             </dependentAssembly>
             <dependentAssembly>
                  <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/packages.config b/src/Orchard.Web/Modules/Orchard.AuditTrail/packages.config
index a8752aa1c..e19361cb1 100644
--- a/src/Orchard.Web/Modules/Orchard.AuditTrail/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/packages.config
@@ -6,7 +6,7 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="XMLDiffPatch" version="1.0.8.28" targetFramework="net48" />
-</packages>
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Web.config b/src/Orchard.Web/Modules/Orchard.Autoroute/Web.config
index 7c4a9d858..dd91d87a6 100644
--- a/src/Orchard.Web/Modules/Orchard.Autoroute/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Web.config
@@ -53,7 +53,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj
index 7099a743e..822f95b4f 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Orchard.Azure.MediaServices.csproj
@@ -76,14 +76,14 @@
     <Reference Include="Microsoft.Data.Services.Client, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.8.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Microsoft.IdentityModel.JsonWebTokens.5.2.4\lib\net451\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
+    <Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Microsoft.IdentityModel.JsonWebTokens.5.7.0\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.IdentityModel.Logging, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Microsoft.IdentityModel.Logging.5.2.4\lib\net451\Microsoft.IdentityModel.Logging.dll</HintPath>
+    <Reference Include="Microsoft.IdentityModel.Logging, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Microsoft.IdentityModel.Logging.5.7.0\lib\net461\Microsoft.IdentityModel.Logging.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.IdentityModel.Tokens, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Microsoft.IdentityModel.Tokens.5.2.4\lib\net451\Microsoft.IdentityModel.Tokens.dll</HintPath>
+    <Reference Include="Microsoft.IdentityModel.Tokens, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Microsoft.IdentityModel.Tokens.5.7.0\lib\net461\Microsoft.IdentityModel.Tokens.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.Practices.TransientFaultHandling.Core, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
@@ -109,8 +109,8 @@
     <Reference Include="Microsoft.WindowsAzure.Storage, Version=5.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\WindowsAzure.Storage.5.0.2\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
@@ -121,8 +121,8 @@
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
     <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.IdentityModel.Tokens.Jwt, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\System.IdentityModel.Tokens.Jwt.5.2.4\lib\net451\System.IdentityModel.Tokens.Jwt.dll</HintPath>
+    <Reference Include="System.IdentityModel.Tokens.Jwt, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\System.IdentityModel.Tokens.Jwt.5.7.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll</HintPath>
     </Reference>
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Spatial, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Web.config b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Web.config
index 999404c7c..c459044f1 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Web.config
@@ -51,7 +51,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/packages.config b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/packages.config
index 0b1ef3eba..09787dc07 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/packages.config
@@ -11,15 +11,15 @@
   <package id="Microsoft.Data.Edm" version="5.8.4" targetFramework="net48" />
   <package id="Microsoft.Data.OData" version="5.8.4" targetFramework="net48" />
   <package id="Microsoft.Data.Services.Client" version="5.8.4" targetFramework="net48" />
-  <package id="Microsoft.IdentityModel.JsonWebTokens" version="5.2.4" targetFramework="net48" />
-  <package id="Microsoft.IdentityModel.Logging" version="5.2.4" targetFramework="net48" />
-  <package id="Microsoft.IdentityModel.Tokens" version="5.2.4" targetFramework="net48" />
+  <package id="Microsoft.IdentityModel.JsonWebTokens" version="5.7.0" targetFramework="net48" />
+  <package id="Microsoft.IdentityModel.Logging" version="5.7.0" targetFramework="net48" />
+  <package id="Microsoft.IdentityModel.Tokens" version="5.7.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="Orchard.WindowsAzure.Diagnostics" version="2.7.0.0" targetFramework="net48" />
-  <package id="System.IdentityModel.Tokens.Jwt" version="5.2.4" targetFramework="net48" />
+  <package id="System.IdentityModel.Tokens.Jwt" version="5.7.0" targetFramework="net48" />
   <package id="System.Spatial" version="5.8.4" targetFramework="net48" />
   <package id="TransientFaultHandling.Core" version="5.1.1209.1" targetFramework="net48" />
   <package id="windowsazure.mediaservices" version="3.4.0.0" targetFramework="net48" />
diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj b/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj
index d0b71207f..ed3b9bcf0 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj
@@ -100,8 +100,8 @@
     <Reference Include="Microsoft.WindowsFabric.Data.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.WindowsAzure.Caching.2.4.0.0\lib\net40-full\Microsoft.WindowsFabric.Data.Common.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
@@ -218,4 +218,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Web.config b/src/Orchard.Web/Modules/Orchard.Azure/Web.config
index 6a4fb0f7e..de8a44fc6 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Azure/Web.config
@@ -63,7 +63,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Azure/packages.config b/src/Orchard.Web/Modules/Orchard.Azure/packages.config
index 1caf16749..3ca59d4ee 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Azure/packages.config
@@ -12,9 +12,9 @@
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="Microsoft.WindowsAzure.Caching" version="2.4.0.0" targetFramework="net48" />
   <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="Orchard.WindowsAzure.ServiceRuntime" version="2.7.0.0" targetFramework="net48" />
   <package id="System.Spatial" version="5.8.4" targetFramework="net48" />
   <package id="WindowsAzure.Storage" version="5.0.2" targetFramework="net48" />
-</packages>
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Web.config b/src/Orchard.Web/Modules/Orchard.Blogs/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Caching/Web.config b/src/Orchard.Web/Modules/Orchard.Caching/Web.config
index 9b5d042d1..d3d43517f 100644
--- a/src/Orchard.Web/Modules/Orchard.Caching/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Caching/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleRootWebConfig.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleRootWebConfig.txt
index 50753e181..a00ea74ab 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleRootWebConfig.txt
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleRootWebConfig.txt
@@ -47,7 +47,7 @@
         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
                 <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
+                <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
             </dependentAssembly>
             <dependentAssembly>
                 <assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Web.config b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Web.config
index 9b5d042d1..d3d43517f 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Web.config b/src/Orchard.Web/Modules/Orchard.Comments/Web.config
index fbf55500e..2e75b2e7c 100644
--- a/src/Orchard.Web/Modules/Orchard.Comments/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Comments/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Conditions/Web.config b/src/Orchard.Web/Modules/Orchard.Conditions/Web.config
index 326a39614..b49058725 100644
--- a/src/Orchard.Web/Modules/Orchard.Conditions/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Conditions/Web.config
@@ -52,7 +52,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Web.config b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Web.config b/src/Orchard.Web/Modules/Orchard.ContentPicker/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config b/src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Web.config b/src/Orchard.Web/Modules/Orchard.CustomForms/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.CustomForms/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config b/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config
index 3b5d12341..a043fe512 100644
--- a/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Web.config b/src/Orchard.Web/Modules/Orchard.DesignerTools/Web.config
index 3ab218f54..6467d9f0d 100644
--- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj b/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj
index 1b17c9c07..df2c9dd01 100644
--- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj
+++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj
@@ -65,8 +65,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Web.config b/src/Orchard.Web/Modules/Orchard.DynamicForms/Web.config
index 83edfe666..f791108ba 100644
--- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Web.config
@@ -57,7 +57,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/packages.config b/src/Orchard.Web/Modules/Orchard.DynamicForms/packages.config
index 44b10a9b4..4fae832de 100644
--- a/src/Orchard.Web/Modules/Orchard.DynamicForms/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/packages.config
@@ -7,5 +7,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj b/src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj
index d5dcfd97d..ed6a53a92 100644
--- a/src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj
@@ -68,8 +68,8 @@
     <Reference Include="MimeKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\MimeKit.3.1.1\lib\net48\MimeKit.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
diff --git a/src/Orchard.Web/Modules/Orchard.Email/Web.config b/src/Orchard.Web/Modules/Orchard.Email/Web.config
index 1149fd7ed..975f0c223 100644
--- a/src/Orchard.Web/Modules/Orchard.Email/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Email/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Email/packages.config b/src/Orchard.Web/Modules/Orchard.Email/packages.config
index f172c28e1..58191e638 100644
--- a/src/Orchard.Web/Modules/Orchard.Email/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Email/packages.config
@@ -7,7 +7,7 @@
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="MimeKit" version="3.1.1" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net48" />
   <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Web.config b/src/Orchard.Web/Modules/Orchard.Fields/Web.config
index 8fae9643f..a5c193197 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj b/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj
index 621b2818a..17d3fa58b 100644
--- a/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj
@@ -54,8 +54,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
@@ -172,4 +172,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Web.config b/src/Orchard.Web/Modules/Orchard.Forms/Web.config
index 68cba4a35..df4c6983f 100644
--- a/src/Orchard.Web/Modules/Orchard.Forms/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Forms/Web.config
@@ -51,7 +51,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Forms/packages.config b/src/Orchard.Web/Modules/Orchard.Forms/packages.config
index 96de43e4a..423014ad0 100644
--- a/src/Orchard.Web/Modules/Orchard.Forms/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Forms/packages.config
@@ -4,5 +4,5 @@
   <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ImageEditor/Web.config b/src/Orchard.Web/Modules/Orchard.ImageEditor/Web.config
index 510d562fe..434d94d1a 100644
--- a/src/Orchard.Web/Modules/Orchard.ImageEditor/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ImageEditor/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Web.config b/src/Orchard.Web/Modules/Orchard.ImportExport/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.ImportExport/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Web.config b/src/Orchard.Web/Modules/Orchard.Indexing/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Indexing/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Indexing/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.JobsQueue/Orchard.JobsQueue.csproj b/src/Orchard.Web/Modules/Orchard.JobsQueue/Orchard.JobsQueue.csproj
index 323423ca7..7d665223d 100644
--- a/src/Orchard.Web/Modules/Orchard.JobsQueue/Orchard.JobsQueue.csproj
+++ b/src/Orchard.Web/Modules/Orchard.JobsQueue/Orchard.JobsQueue.csproj
@@ -60,8 +60,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
@@ -196,4 +196,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.JobsQueue/Web.config b/src/Orchard.Web/Modules/Orchard.JobsQueue/Web.config
index 1149fd7ed..975f0c223 100644
--- a/src/Orchard.Web/Modules/Orchard.JobsQueue/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.JobsQueue/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.JobsQueue/packages.config b/src/Orchard.Web/Modules/Orchard.JobsQueue/packages.config
index 3a05f90ac..4edd53141 100644
--- a/src/Orchard.Web/Modules/Orchard.JobsQueue/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.JobsQueue/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
index 1c544f1c0..aeaf2d938 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
@@ -58,8 +58,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Web.config b/src/Orchard.Web/Modules/Orchard.Layouts/Web.config
index 0908d535f..13faf444e 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Web.config
@@ -43,7 +43,7 @@
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/packages.config b/src/Orchard.Web/Modules/Orchard.Layouts/packages.config
index d391928d1..9504b7d9d 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/packages.config
@@ -7,6 +7,6 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="YamlDotNet" version="11.1.1" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Lists/Web.config b/src/Orchard.Web/Modules/Orchard.Lists/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Lists/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Lists/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Localization/Web.config b/src/Orchard.Web/Modules/Orchard.Localization/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Localization/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Localization/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj b/src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj
index b01ce63de..c4a391378 100644
--- a/src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj
@@ -52,9 +52,6 @@
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="DotNetZip, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\DotNetZip.1.12.0\lib\net20\DotNetZip.dll</HintPath>
-    </Reference>
     <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\lib\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
     </Reference>
@@ -64,6 +61,7 @@
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.IO.Compression" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.ApplicationServices" />
     <Reference Include="System.Web.DynamicData" />
@@ -204,4 +202,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs b/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs
index f11190b7c..3084bd871 100644
--- a/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs
+++ b/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs
@@ -1,9 +1,9 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.IO.Compression;
 using System.Linq;
 using System.Web;
-using Ionic.Zip;
 using Orchard.ContentManagement;
 using Orchard.FileSystems.Media;
 using Orchard.Localization;
@@ -194,7 +194,7 @@ namespace Orchard.Media.Services {
         /// <param name="bytes">The array of bytes with the file's contents.</param>
         /// <param name="extractZip">Boolean value indicating weather zip files should be extracted.</param>
         /// <returns>The path to the uploaded file.</returns>
-        public string UploadMediaFile(string folderPath, string fileName, byte [] bytes, bool extractZip) {
+        public string UploadMediaFile(string folderPath, string fileName, byte[] bytes, bool extractZip) {
             Argument.ThrowIfNullOrEmpty(folderPath, "folderPath");
             Argument.ThrowIfNullOrEmpty(fileName, "fileName");
             Argument.ThrowIfNull(bytes, "bytes");
@@ -274,16 +274,16 @@ namespace Orchard.Media.Services {
 
                 // must be in the whitelist
                 MediaSettingsPart mediaSettings = currentSite.As<MediaSettingsPart>();
-                
+
                 if (mediaSettings == null) {
                     return false;
-                } 
-                
-                if(String.IsNullOrWhiteSpace(mediaSettings.UploadAllowedFileTypeWhitelist)) {
-                    return true;
-                } 
+                }
 
-                if(!mediaSettings.UploadAllowedFileTypeWhitelist.ToUpperInvariant().Split(' ').Contains(extension.ToUpperInvariant())) {
+                if (String.IsNullOrWhiteSpace(mediaSettings.UploadAllowedFileTypeWhitelist)) {
+                    return true;
+                }
+
+                if (!mediaSettings.UploadAllowedFileTypeWhitelist.ToUpperInvariant().Split(' ').Contains(extension.ToUpperInvariant())) {
                     return false;
                 }
             }
@@ -305,28 +305,26 @@ namespace Orchard.Media.Services {
             Argument.ThrowIfNullOrEmpty(targetFolder, "targetFolder");
             Argument.ThrowIfNull(zipStream, "zipStream");
 
-            using (var fileInflater = ZipFile.Read(zipStream)) {
+            using (var fileInflater = new ZipArchive(zipStream)) {
                 // We want to preserve whatever directory structure the zip file contained instead
                 // of flattening it.
                 // The API below doesn't necessarily return the entries in the zip file in any order.
                 // That means the files in subdirectories can be returned as entries from the stream 
                 // before the directories that contain them, so we create directories as soon as first
                 // file below their path is encountered.
-                foreach (ZipEntry entry in fileInflater) {
+                foreach (var entry in fileInflater.Entries) {
                     if (entry == null) {
                         continue;
                     }
 
-                    if (!entry.IsDirectory && !string.IsNullOrEmpty(entry.FileName)) {
-
+                    if (!string.IsNullOrEmpty(entry.Name)) {
                         // skip disallowed files
-                        if (FileAllowed(entry.FileName, false)) {
-                            string fullFileName = _storageProvider.Combine(targetFolder, entry.FileName);
+                        if (FileAllowed(entry.Name, false)) {
+                            string fullFileName = _storageProvider.Combine(targetFolder, entry.FullName);
 
-                            using (var stream = entry.OpenReader()) {
+                            using (var stream = entry.Open()) {
                                 // the call will return false if the file already exists
                                 if (!_storageProvider.TrySaveStream(fullFileName, stream)) {
-                                    
                                     // try to delete the file and save again
                                     try {
                                         _storageProvider.DeleteFile(fullFileName);
diff --git a/src/Orchard.Web/Modules/Orchard.Media/Web.config b/src/Orchard.Web/Modules/Orchard.Media/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Media/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Media/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Media/packages.config b/src/Orchard.Web/Modules/Orchard.Media/packages.config
index 5de97f737..1c55d6960 100644
--- a/src/Orchard.Web/Modules/Orchard.Media/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Media/packages.config
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="DotNetZip" version="1.12.0" targetFramework="net48" />
   <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net48" />
   <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Orchard.MediaLibrary.csproj b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Orchard.MediaLibrary.csproj
index 11f70f309..c896c8e71 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Orchard.MediaLibrary.csproj
+++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Orchard.MediaLibrary.csproj
@@ -58,8 +58,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
@@ -451,4 +451,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Web.config b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Web.config
index 3ab218f54..6467d9f0d 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/packages.config b/src/Orchard.Web/Modules/Orchard.MediaLibrary/packages.config
index 3a05f90ac..4edd53141 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.MediaPicker/Web.config b/src/Orchard.Web/Modules/Orchard.MediaPicker/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaPicker/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.MediaPicker/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.MediaProcessing/Web.config b/src/Orchard.Web/Modules/Orchard.MediaProcessing/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaProcessing/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.MediaProcessing/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.MessageBus/Web.config b/src/Orchard.Web/Modules/Orchard.MessageBus/Web.config
index 9b5d042d1..d3d43517f 100644
--- a/src/Orchard.Web/Modules/Orchard.MessageBus/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.MessageBus/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Migrations/Web.config b/src/Orchard.Web/Modules/Orchard.Migrations/Web.config
index 9b5d042d1..d3d43517f 100644
--- a/src/Orchard.Web/Modules/Orchard.Migrations/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Migrations/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Web.config b/src/Orchard.Web/Modules/Orchard.Modules/Web.config
index 5d7a337e5..d7b3d6256 100644
--- a/src/Orchard.Web/Modules/Orchard.Modules/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Modules/Web.config
@@ -53,7 +53,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Web.config b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Web.config
index 5d7a337e5..d7b3d6256 100644
--- a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Web.config
@@ -53,7 +53,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Web.config b/src/Orchard.Web/Modules/Orchard.OutputCache/Web.config
index 64b9971e8..d85ea246e 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Web.config b/src/Orchard.Web/Modules/Orchard.Packaging/Web.config
index 5706c1b4b..9d27699e2 100644
--- a/src/Orchard.Web/Modules/Orchard.Packaging/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Packaging/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Web.config b/src/Orchard.Web/Modules/Orchard.Pages/Web.config
index 55653b53f..6295ffe08 100644
--- a/src/Orchard.Web/Modules/Orchard.Pages/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Pages/Web.config
@@ -51,7 +51,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Tests/app.config b/src/Orchard.Web/Modules/Orchard.Projections/Tests/app.config
index 9493cfeea..6ada2cd01 100644
--- a/src/Orchard.Web/Modules/Orchard.Projections/Tests/app.config
+++ b/src/Orchard.Web/Modules/Orchard.Projections/Tests/app.config
@@ -16,7 +16,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Web.config b/src/Orchard.Web/Modules/Orchard.Projections/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Projections/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Projections/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.PublishLater/Web.config b/src/Orchard.Web/Modules/Orchard.PublishLater/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.PublishLater/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.PublishLater/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Recipes/Web.config b/src/Orchard.Web/Modules/Orchard.Recipes/Web.config
index f57e23503..18574b08b 100644
--- a/src/Orchard.Web/Modules/Orchard.Recipes/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Recipes/Web.config
@@ -52,7 +52,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Redis/Orchard.Redis.csproj b/src/Orchard.Web/Modules/Orchard.Redis/Orchard.Redis.csproj
index 39eaa9dc4..766beb457 100644
--- a/src/Orchard.Web/Modules/Orchard.Redis/Orchard.Redis.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Redis/Orchard.Redis.csproj
@@ -53,8 +53,8 @@
       <HintPath>..\..\..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.CSharp" />
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
@@ -161,4 +161,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Redis/Web.config b/src/Orchard.Web/Modules/Orchard.Redis/Web.config
index 050c8f125..b2bd44ec1 100644
--- a/src/Orchard.Web/Modules/Orchard.Redis/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Redis/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/Orchard.Redis/packages.config b/src/Orchard.Web/Modules/Orchard.Redis/packages.config
index 9e7bf972f..e967b80b0 100644
--- a/src/Orchard.Web/Modules/Orchard.Redis/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Redis/packages.config
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="StackExchange.Redis" version="1.0.481" targetFramework="net48" />
-</packages>
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Resources/Web.config b/src/Orchard.Web/Modules/Orchard.Resources/Web.config
index ae6d6621d..41c6d90cd 100644
--- a/src/Orchard.Web/Modules/Orchard.Resources/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Resources/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Web.config b/src/Orchard.Web/Modules/Orchard.Roles/Web.config
index 1149fd7ed..975f0c223 100644
--- a/src/Orchard.Web/Modules/Orchard.Roles/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Roles/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Rules/Web.config b/src/Orchard.Web/Modules/Orchard.Rules/Web.config
index 1e15feddd..c84658808 100644
--- a/src/Orchard.Web/Modules/Orchard.Rules/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Rules/Web.config
@@ -57,7 +57,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Web.config b/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Web.config b/src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Web.config
index 050c8f125..b2bd44ec1 100644
--- a/src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/Orchard.Scripting/Web.config b/src/Orchard.Web/Modules/Orchard.Scripting/Web.config
index 050c8f125..b2bd44ec1 100644
--- a/src/Orchard.Web/Modules/Orchard.Scripting/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Scripting/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/Orchard.Search/Web.config b/src/Orchard.Web/Modules/Orchard.Search/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Search/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Search/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Web.config b/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Web.config b/src/Orchard.Web/Modules/Orchard.Setup/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Setup/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Setup/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Web.config b/src/Orchard.Web/Modules/Orchard.Tags/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Tags/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Tags/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.TaskLease/Web.config b/src/Orchard.Web/Modules/Orchard.TaskLease/Web.config
index 050c8f125..b2bd44ec1 100644
--- a/src/Orchard.Web/Modules/Orchard.TaskLease/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.TaskLease/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Orchard.Taxonomies.csproj b/src/Orchard.Web/Modules/Orchard.Taxonomies/Orchard.Taxonomies.csproj
index a2d6449b3..eeceab2c3 100644
--- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Orchard.Taxonomies.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Orchard.Taxonomies.csproj
@@ -59,8 +59,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations">
@@ -288,4 +288,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Web.config b/src/Orchard.Web/Modules/Orchard.Taxonomies/Web.config
index b12ba08aa..198678287 100644
--- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Web.config
@@ -41,7 +41,7 @@
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/packages.config b/src/Orchard.Web/Modules/Orchard.Taxonomies/packages.config
index 343350b13..a8ccef4a9 100644
--- a/src/Orchard.Web/Modules/Orchard.Taxonomies/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/packages.config
@@ -7,5 +7,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Web.config b/src/Orchard.Web/Modules/Orchard.Templates/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Templates/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Templates/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Themes/Web.config b/src/Orchard.Web/Modules/Orchard.Themes/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Themes/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Themes/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Tokens/Tests/app.config b/src/Orchard.Web/Modules/Orchard.Tokens/Tests/app.config
index cda2fe9df..ed0f1f563 100644
--- a/src/Orchard.Web/Modules/Orchard.Tokens/Tests/app.config
+++ b/src/Orchard.Web/Modules/Orchard.Tokens/Tests/app.config
@@ -16,7 +16,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Orchard.Tokens/Web.config b/src/Orchard.Web/Modules/Orchard.Tokens/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Tokens/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Tokens/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Users/Web.config b/src/Orchard.Web/Modules/Orchard.Users/Web.config
index 1149fd7ed..975f0c223 100644
--- a/src/Orchard.Web/Modules/Orchard.Users/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Users/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Warmup/Web.config b/src/Orchard.Web/Modules/Orchard.Warmup/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Warmup/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Warmup/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Web.config b/src/Orchard.Web/Modules/Orchard.Widgets/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.Widgets/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/Orchard.Workflows.csproj b/src/Orchard.Web/Modules/Orchard.Workflows/Orchard.Workflows.csproj
index 97df8d937..3e85f4f0b 100644
--- a/src/Orchard.Web/Modules/Orchard.Workflows/Orchard.Workflows.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Workflows/Orchard.Workflows.csproj
@@ -58,8 +58,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
@@ -307,4 +307,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/Web.config b/src/Orchard.Web/Modules/Orchard.Workflows/Web.config
index 1149fd7ed..975f0c223 100644
--- a/src/Orchard.Web/Modules/Orchard.Workflows/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.Workflows/Web.config
@@ -55,7 +55,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/packages.config b/src/Orchard.Web/Modules/Orchard.Workflows/packages.config
index 3a05f90ac..4edd53141 100644
--- a/src/Orchard.Web/Modules/Orchard.Workflows/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Workflows/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.jQuery/Web.config b/src/Orchard.Web/Modules/Orchard.jQuery/Web.config
index 836843e00..dbacb1007 100644
--- a/src/Orchard.Web/Modules/Orchard.jQuery/Web.config
+++ b/src/Orchard.Web/Modules/Orchard.jQuery/Web.config
@@ -54,7 +54,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/SysCache/Web.config b/src/Orchard.Web/Modules/SysCache/Web.config
index 050c8f125..b2bd44ec1 100644
--- a/src/Orchard.Web/Modules/SysCache/Web.config
+++ b/src/Orchard.Web/Modules/SysCache/Web.config
@@ -49,7 +49,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
          </assemblyBinding>
   </runtime>
diff --git a/src/Orchard.Web/Modules/TinyMce/Web.config b/src/Orchard.Web/Modules/TinyMce/Web.config
index 5d7a337e5..d7b3d6256 100644
--- a/src/Orchard.Web/Modules/TinyMce/Web.config
+++ b/src/Orchard.Web/Modules/TinyMce/Web.config
@@ -53,7 +53,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Modules/Upgrade/Upgrade.csproj b/src/Orchard.Web/Modules/Upgrade/Upgrade.csproj
index 9b4d80207..002f58771 100644
--- a/src/Orchard.Web/Modules/Upgrade/Upgrade.csproj
+++ b/src/Orchard.Web/Modules/Upgrade/Upgrade.csproj
@@ -61,8 +61,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Upgrade/Web.config b/src/Orchard.Web/Modules/Upgrade/Web.config
index 2ea1387f8..27dd9de80 100644
--- a/src/Orchard.Web/Modules/Upgrade/Web.config
+++ b/src/Orchard.Web/Modules/Upgrade/Web.config
@@ -44,7 +44,7 @@
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
diff --git a/src/Orchard.Web/Modules/Upgrade/packages.config b/src/Orchard.Web/Modules/Upgrade/packages.config
index c464a2ac7..44568f4f9 100644
--- a/src/Orchard.Web/Modules/Upgrade/packages.config
+++ b/src/Orchard.Web/Modules/Upgrade/packages.config
@@ -8,6 +8,6 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
-</packages>
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj
index f793ce0b4..563f9d6ba 100644
--- a/src/Orchard.Web/Orchard.Web.csproj
+++ b/src/Orchard.Web/Orchard.Web.csproj
@@ -78,8 +78,8 @@
     <Reference Include="MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
       <HintPath>..\packages\MySql.Data.6.7.9\lib\net45\MySql.Data.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="Npgsql, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
       <HintPath>..\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
diff --git a/src/Orchard.Web/Themes/Web.config b/src/Orchard.Web/Themes/Web.config
index 6f22dac94..f09510e13 100644
--- a/src/Orchard.Web/Themes/Web.config
+++ b/src/Orchard.Web/Themes/Web.config
@@ -77,7 +77,7 @@
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-                       <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+                       <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
                 </dependentAssembly>
                 <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/Web.config b/src/Orchard.Web/Web.config
index 63a710c6c..913c4f04d 100644
--- a/src/Orchard.Web/Web.config
+++ b/src/Orchard.Web/Web.config
@@ -159,7 +159,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
diff --git a/src/Orchard.Web/packages.config b/src/Orchard.Web/packages.config
index d27ff6119..a3cf9084f 100644
--- a/src/Orchard.Web/packages.config
+++ b/src/Orchard.Web/packages.config
@@ -10,7 +10,7 @@
   <package id="Microsoft.Owin.Host.SystemWeb" version="4.1.1" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="MySql.Data" version="6.7.9" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="Npgsql" version="2.2.3" targetFramework="net48" />
   <package id="Orchard.NuGet.Core" version="1.1.0.0" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj
index 56e9fbc43..c74cd774f 100644
--- a/src/Orchard/Orchard.Framework.csproj
+++ b/src/Orchard/Orchard.Framework.csproj
@@ -83,8 +83,8 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
diff --git a/src/Orchard/app.config b/src/Orchard/app.config
index 88432b48a..bc4937df3 100644
--- a/src/Orchard/app.config
+++ b/src/Orchard/app.config
@@ -20,7 +20,7 @@
 			</dependentAssembly>
 			<dependentAssembly>
 				<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-				<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+				<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
 			</dependentAssembly>
 			<dependentAssembly>
 				<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
diff --git a/src/Orchard/packages.config b/src/Orchard/packages.config
index ae21c35d4..73bb52b83 100644
--- a/src/Orchard/packages.config
+++ b/src/Orchard/packages.config
@@ -14,7 +14,7 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.Owin" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
 </packages>
\ No newline at end of file

From 0d93cb1d8d819e46bc5cfc7d55d1797086d965d2 Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Fri, 6 Dec 2024 09:59:15 +0100
Subject: [PATCH 3/9] #8816: Compilation workflow should test the setup and
 code generation (#8817)

* Updating Compile workflow with setup and code generation steps

* Updating NHibernate reference and OrchardBasicCorrectness.ruleset path in ModuleTestsCsProj code generation template

* Ignoring CS2008 warning when recompiling with generated modules, because the theme and test projects don't have .cs files

* Generating a test project should also include packages.config

* Fixing the relative path of Orchard.Core and Orchard.Framework in the generated test project

* A bit of code styling in the Compile workflow

* Updating Readme

* Revert "A bit of code styling in the Compile workflow"

This reverts commit 7b01ebbad0422d402362b1d08a74b1240a19daa4.
---
 .github/workflows/compile.yml                 | 24 ++++++++++++++++-
 README.md                                     | 26 +++++++------------
 .../ModuleTestsCsProj.txt                     | 10 +++----
 .../ModuleTestsPackagesConfig.txt             |  7 +++++
 .../Commands/CodeGenerationCommands.cs        | 16 +++++++-----
 .../Orchard.CodeGeneration.csproj             |  3 ++-
 6 files changed, 57 insertions(+), 29 deletions(-)
 create mode 100644 src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt

diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml
index 602548d78..eb46871be 100644
--- a/.github/workflows/compile.yml
+++ b/.github/workflows/compile.yml
@@ -26,11 +26,33 @@ jobs:
         uses: microsoft/setup-msbuild@v2
 
       - name: Compile
-        run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
+        run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /p:MvcBuildViews=true
 
       - name: Test
         run: msbuild Orchard.proj /m /v:minimal /t:Test
 
+      - name: Run Orchard setup
+        run: |
+          $commandFile = 'src/Orchard.Web/bin/setup-commands.txt'
+          New-Item -Path $commandFile -ItemType File -Force
+          Set-Content -Path $commandFile -Value 'setup /SiteName:Orchard /AdminUsername:admin /AdminPassword:Password1! /DatabaseProvider:SqlCe /Recipe:Default'
+          & 'src/Orchard.Web/bin/Orchard.exe' @$commandFile
+
+      - name: Run code generation
+        run: |
+          $commandFile = 'src/Orchard.Web/bin/codegen-commands.txt'
+          New-Item -Path $commandFile -ItemType File -Force
+          Set-Content -Path $commandFile -Value @'
+            feature enable Orchard.CodeGeneration
+            codegen module Orchard.CodeGeneration.TestModule
+            codegen theme Orchard.CodeGeneration.TestTheme /CreateProject:true
+            codegen moduletests Orchard.CodeGeneration.TestModule
+          '@
+          & 'src/Orchard.Web/bin/Orchard.exe' @$commandFile
+
+      - name: Compile with generated projects
+        run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /NoWarn:CS2008
+
   compile-node:
     name: Compile client-side assets
     defaults:
diff --git a/README.md b/README.md
index 5a7073d25..19d04cb9e 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,14 @@
 # Orchard
 
-Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
+Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform. You are looking at Orchard 1, the older, .NET Framework-based version that has been in development since 2009.
 
-[![Join the chat at https://gitter.im/OrchardCMS/Orchard](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OrchardCMS/Orchard?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+If you're starting a new project (or maintaining a project built on Orchard 1), you should check out [Orchard Core](https://github.com/OrchardCMS/OrchardCore), the new generation of Orchard built on ASP.NET Core. You can also try it for free on [DotNest.com](https://dotnest.com)!
 
-You can try it for free on [DotNest.com](https://dotnest.com) or on Microsoft Azure by clicking on this button.
-
-[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/OutercurveFoundation.OrchardCMS)
+Join the community discussion on [Discord](https://orchardcore.net/discord), where we also have a [channel dedicated to Orchard 1](https://discord.com/channels/551136772243980291/551137194689953848).
 
 ## About The Orchard Project
 
-#### Please visit our website at https://orchardproject.net for the most current information about this project.
+#### Please visit our website at https://orchardcore.net for the most current information about this project.
 
 Orchard is a free, open source, community-focused **Content Management System** built on the ASP.NET MVC platform.
 
@@ -24,12 +22,12 @@ Our mission is to empower our users and foster a dedicated and diverse community
 
 Orchard is currently in version **[1.10.3](https://github.com/OrchardCMS/Orchard/releases/tag/1.10.3)**: It contains bugfixes and the more impactful changes and new features added in the latest major version (*1.10*).
 
-We invite participation by the developer community in shaping the project’s direction, so that we can publicly validate our designs and development approach. 
+We invite participation by the developer community in shaping the project's direction, so that we can publicly validate our designs and development approach. 
 All our releases are available on our [Releases](https://github.com/OrchardCMS/Orchard/releases) page, and we encourage interested developers to check out the source code on the Orchard GitHub site and get involved with the project.
 
 * [Download the latest release](https://github.com/OrchardCMS/Orchard/releases)
-* [Feature roadmap](https://docs.orchardproject.net/en/latest/Documentation/Feature-roadmap/)
-* [Docs and designs/specs](https://docs.orchardproject.net)
+* [Feature roadmap](https://docs.orchardcore.net/projects/O1/en/latest/Documentation/Feature-roadmap/)
+* [Docs and designs/specs](https://docs.orchardcore.net/projects/O1/en/latest/)
 
 ## How To Get Involved
 
@@ -42,11 +40,7 @@ There are many ways you can contribute to Orchard:
 * [Find and file a bug](https://github.com/OrchardCMS/Orchard/issues)
 * [Propose a feature idea](https://github.com/OrchardCMS/Orchard/issues/new)
 * [Ask and answer questions on Stack Overflow](https://stackoverflow.com/questions/tagged/orchardcms)
-* [Participate in our gitter.im chatroom](https://gitter.im/OrchardCMS/Orchard)
-* [Submit a pull request](https://docs.orchardproject.net/en/latest/Documentation/Contributing-patches/)
+* [Join us on Discord](https://orchardcore.net/discord)
+* [Submit a pull request](https://docs.orchardcore.net/projects/O1/en/latest/Documentation/Contributing-patches/)
 * [Translate Orchard](https://crowdin.com/project/orchard-cms)
-* [Contribute modules and themes to our gallery](https://gallery.orchardproject.net/)
-
-## The Future Of Orchard CMS: Orchard Core
-
-As the underlying frameworks (.NET, ASP.NET and ASP.NET MVC) are constantly evolving, Orchard of course keeps track of the changes and improvements of these: Orchard Core is the next generation of Orchard releases that is based on [ASP.NET Core](https://www.asp.net/core). Just like the current Orchard project, it's fully [open-source and is publicly available on GitHub](https://github.com/OrchardCMS/OrchardCore). Orchard Core (as a framework) is being built from scratch: it's still in development and does not share any of its code base (at least directly) with the current versions (1.x) of Orchard.
+* [Contribute modules and themes to our gallery](https://gallery.orchardproject.net)
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
index 8bd755adb..889b3c7fa 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
@@ -21,7 +21,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet>..\..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -35,16 +35,16 @@
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Autofac">
+    <Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
     </Reference>
     <Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="NHibernate">
-      <HintPath>..\..\..\..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
+    <Reference Include="NHibernate, Version=4.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\packages\NHibernate.4.1.2.4000\lib\net40\NHibernate.dll</HintPath>
     </Reference>
-    <Reference Include="nunit.framework">
+    <Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="System" />
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt
new file mode 100644
index 000000000..6b79f20b1
--- /dev/null
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Autofac" version="3.5.2" targetFramework="net48" />
+  <package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
+  <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
+  <package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs
index 7f3523094..398617a25 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs
@@ -161,6 +161,8 @@ namespace Orchard.CodeGeneration.Commands {
             templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
             File.WriteAllText(propertiesPath + "\\AssemblyInfo.cs", templateText);
             content.Add(propertiesPath + "\\AssemblyInfo.cs");
+            File.WriteAllText(testsPath + "packages.config", File.ReadAllText(_codeGenTemplatePath + "ModuleTestsPackagesConfig.txt"));
+            content.Add(testsPath + "packages.config");
 
             var itemGroup = CreateProjectItemGroup(testsPath, content, folders);
 
@@ -168,7 +170,7 @@ namespace Orchard.CodeGeneration.Commands {
             csprojText = csprojText.Replace("$$ProjectName$$", projectName);
             csprojText = csprojText.Replace("$$TestsProjectGuid$$", projectGuid);
             csprojText = csprojText.Replace("$$FileIncludes$$", itemGroup ?? "");
-            csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences());
+            csprojText = csprojText.Replace("$$OrchardReferences$$", GetOrchardReferences(modulesFolderRelativeDepth: 3));
 
             File.WriteAllText(testsPath + projectName + ".csproj", csprojText);
 
@@ -327,15 +329,17 @@ namespace Orchard.CodeGeneration.Commands {
             return text;
         }
 
-        private static string GetOrchardReferences() {
+        private static string GetOrchardReferences(int modulesFolderRelativeDepth = 2) {
+            var frameworkRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth + 1));
+            var coreRelativeDepth = string.Join("\\", Enumerable.Repeat("..", modulesFolderRelativeDepth));
             return IsSourceEnlistment() ?
-@"<ProjectReference Include=""..\..\..\Orchard\Orchard.Framework.csproj"">
-      <Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
+$@"<ProjectReference Include=""{frameworkRelativeDepth}\Orchard\Orchard.Framework.csproj"">
+      <Project>{{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}}</Project>
       <Name>Orchard.Framework</Name>
       <Private>$(MvcBuildViews)</Private>
     </ProjectReference>
-    <ProjectReference Include=""..\..\Core\Orchard.Core.csproj"">
-      <Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
+    <ProjectReference Include=""{coreRelativeDepth}\Core\Orchard.Core.csproj"">
+      <Project>{{9916839C-39FC-4CEB-A5AF-89CA7E87119F}}</Project>
       <Name>Orchard.Core</Name>
       <Private>$(MvcBuildViews)</Private>
     </ProjectReference>" :
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj
index 05eb8c41b..6565c15f6 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj
@@ -88,6 +88,7 @@
     <Compile Include="Services\CodeGenerationCommandInterpreter.cs" />
   </ItemGroup>
   <ItemGroup>
+    <Content Include="CodeGenerationTemplates\ModuleTestsPackagesConfig.txt" />
     <Content Include="CodeGenerationTemplates\ModuleStylesMinCss.txt" />
     <Content Include="CodeGenerationTemplates\ModuleStylesCss.txt" />
     <Content Include="CodeGenerationTemplates\ModuleStylesLess.txt" />
@@ -158,4 +159,4 @@
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file

From 79f66cebf6921142c3186de4b43fbe1469f19b57 Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Fri, 6 Dec 2024 10:09:52 +0100
Subject: [PATCH 4/9] #8752: Publish/unpublish Menu Items in the Menu editor
 (#8807)

* Cleaning up Core/Navigation/Controllers/AdminController

* Extending Core/Navigation/Controllers/AdminController to be able to publish/unpublish menuitems

* Redirecting to menu when saving a menu item and using the menu item text in the notification

* Fixing that saving a menu item shouldn't publish it if it's unpublished

* Using the menu item text in the notification when publishing and unpublishing too
---
 .../Navigation/Controllers/AdminController.cs | 212 ++++++++++++------
 .../Navigation/Services/MainMenuService.cs    |   4 +-
 .../Core/Navigation/Views/Admin/Index.cshtml  |  19 +-
 3 files changed, 157 insertions(+), 78 deletions(-)

diff --git a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
index bbd1f6218..2337598da 100644
--- a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
@@ -1,74 +1,75 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Linq;
 using System.Web.Mvc;
+using System.Web.Routing;
 using Orchard.ContentManagement;
+using Orchard.ContentManagement.Aspects;
+using Orchard.ContentManagement.Handlers;
+using Orchard.Core.Contents.Settings;
 using Orchard.Core.Navigation.Models;
 using Orchard.Core.Navigation.Services;
 using Orchard.Core.Navigation.ViewModels;
-using Orchard.Localization;
-using Orchard.Mvc.Extensions;
-using Orchard.UI;
-using Orchard.UI.Notify;
-using Orchard.UI.Navigation;
-using Orchard.Utility;
-using System;
-using Orchard.ContentManagement.Handlers;
-using Orchard.Logging;
-using Orchard.Exceptions;
-using Orchard.ContentManagement.Aspects;
-using Orchard.Utility.Extensions;
-using Orchard.Mvc.Html;
-using Orchard.Core.Contents.Settings;
 using Orchard.Data;
-using System.Web.Routing;
+using Orchard.Exceptions;
+using Orchard.Localization;
+using Orchard.Logging;
+using Orchard.Mvc.Extensions;
+using Orchard.Mvc.Html;
+using Orchard.Security;
+using Orchard.UI;
+using Orchard.UI.Navigation;
+using Orchard.UI.Notify;
+using Orchard.Utility;
+using Orchard.Utility.Extensions;
 
 namespace Orchard.Core.Navigation.Controllers {
     [ValidateInput(false)]
     public class AdminController : Controller, IUpdateModel {
+        private readonly IContentManager _contentManager;
+        private readonly ITransactionManager _transactionManager;
+        private readonly IAuthorizer _authorizer;
+        private readonly INotifier _notifier;
         private readonly IMenuService _menuService;
         private readonly INavigationManager _navigationManager;
         private readonly IEnumerable<IContentHandler> _handlers;
         private readonly IMenuManager _menuManager;
-        private readonly IContentManager _contentManager;
-        private readonly ITransactionManager _transactionManager;
 
         public AdminController(
             IOrchardServices orchardServices,
-            IContentManager contentManager,
-            ITransactionManager transactionManager,
             IMenuService menuService,
             IMenuManager menuManager,
             INavigationManager navigationManager,
             IEnumerable<IContentHandler> handlers) {
-            _contentManager = contentManager;
-            _transactionManager = transactionManager;
+            _contentManager = orchardServices.ContentManager;
+            _transactionManager = orchardServices.TransactionManager;
+            _authorizer = orchardServices.Authorizer;
+            _notifier = orchardServices.Notifier;
             _menuService = menuService;
             _menuManager = menuManager;
             _navigationManager = navigationManager;
             _handlers = handlers;
 
-            Services = orchardServices;
             T = NullLocalizer.Instance;
             Logger = NullLogger.Instance;
         }
 
         public Localizer T { get; set; }
         public ILogger Logger { get; set; }
-        public IOrchardServices Services { get; set; }
 
         public ActionResult Index(NavigationManagementViewModel model, int? menuId) {
-            var menus = Services.ContentManager.Query("Menu").List().ToList()
+            var menus = _contentManager.Query("Menu").List().ToList()
                 .OrderBy(x => x.ContentManager.GetItemMetadata(x).DisplayText);
 
             if (!menus.Any()) {
-                if (!Services.Authorizer.Authorize(Permissions.ManageMenus, T("Not allowed to manage menus"))) {
+                if (!_authorizer.Authorize(Permissions.ManageMenus, T("Not allowed to manage menus"))) {
                     return new HttpUnauthorizedResult();
                 }
 
                 return RedirectToAction("Create", "Admin", new { area = "Contents", id = "Menu", returnUrl = Request.RawUrl });
             }
 
-            var allowedMenus = menus.Where(menu => Services.Authorizer.Authorize(Permissions.ManageMenus, menu)).ToList();
+            var allowedMenus = menus.Where(menu => _authorizer.Authorize(Permissions.ManageMenus, menu)).ToList();
 
             if (!allowedMenus.Any()) {
                 return new HttpUnauthorizedResult();
@@ -87,7 +88,11 @@ namespace Orchard.Core.Navigation.Controllers {
             }
 
             if (model.MenuItemEntries == null || !model.MenuItemEntries.Any()) {
-                model.MenuItemEntries = _menuService.GetMenuParts(currentMenu.Id).Select(CreateMenuItemEntries).OrderBy(menuPartEntry => menuPartEntry.Position, new FlatPositionComparer()).ToList();
+                model.MenuItemEntries = _menuService
+                    .GetMenuParts(currentMenu.Id)
+                    .Select(CreateMenuItemEntries)
+                    .OrderBy(menuPartEntry => menuPartEntry.Position, new FlatPositionComparer())
+                    .ToList();
             }
 
             model.MenuItemDescriptors = _menuManager.GetMenuItemTypes();
@@ -100,7 +105,10 @@ namespace Orchard.Core.Navigation.Controllers {
 
         [HttpPost, ActionName("Index")]
         public ActionResult IndexPOST(IList<MenuItemEntry> menuItemEntries, int? menuId) {
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, (menuId.HasValue) ? _menuService.GetMenu(menuId.Value) : null, T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(
+                Permissions.ManageMenus,
+                menuId.HasValue ? _menuService.GetMenu(menuId.Value) : null,
+                T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
 
             // See https://github.com/OrchardCMS/Orchard/issues/948
@@ -123,25 +131,15 @@ namespace Orchard.Core.Navigation.Controllers {
             return RedirectToAction("Index", new { menuId });
         }
 
-        private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart) {
-            return new MenuItemEntry {
-                MenuItemId = menuPart.Id,
-                IsMenuItem = menuPart.Is<MenuItemPart>(),
-                Text = menuPart.MenuText,
-                Position = menuPart.MenuPosition,
-                Url = menuPart.Is<MenuItemPart>()
-                              ? menuPart.As<MenuItemPart>().Url
-                              : _navigationManager.GetUrl(null, Services.ContentManager.GetItemMetadata(menuPart).DisplayRouteValues),
-                ContentItem = menuPart.ContentItem,
-            };
-        }
-
         [HttpPost]
         public ActionResult Delete(int id) {
 
             MenuPart menuPart = _menuService.Get(id);
             int? menuId = null;
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, (menuPart != null) ? _menuService.GetMenu(menuPart.Menu.Id) : null, T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(
+                Permissions.ManageMenus,
+                menuPart == null ? null : _menuService.GetMenu(menuPart.Menu.Id),
+                T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
 
             if (menuPart != null) {
@@ -155,7 +153,8 @@ namespace Orchard.Core.Navigation.Controllers {
 
                 foreach (var menuItem in menuItems.Concat(new[] { menuPart })) {
                     // if the menu item is a concrete content item, don't delete it, just unreference the menu
-                    if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") {
+                    if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype")
+                        || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") {
                         menuPart.Menu = null;
                     }
                     else {
@@ -168,26 +167,18 @@ namespace Orchard.Core.Navigation.Controllers {
             return RedirectToAction("Index", new { menuId });
         }
 
-        bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
-            return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
-        }
-
-        void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) {
-            ModelState.AddModelError(key, errorMessage.ToString());
-        }
-
         public ActionResult CreateMenuItem(string id, int menuId, string returnUrl) {
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
 
             // create a new temporary menu item
-            var menuPart = Services.ContentManager.New<MenuPart>(id);
+            var menuPart = _contentManager.New<MenuPart>(id);
 
             if (menuPart == null)
                 return HttpNotFound();
 
             // load the menu
-            var menu = Services.ContentManager.Get(menuId);
+            var menu = _contentManager.Get(menuId);
 
             if (menu == null)
                 return HttpNotFound();
@@ -196,7 +187,7 @@ namespace Orchard.Core.Navigation.Controllers {
                 // filter the content items for this specific menu
                 menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
                 menuPart.Menu = menu;
-                var model = Services.ContentManager.BuildEditor(menuPart);
+                var model = _contentManager.BuildEditor(menuPart);
 
                 return View(model);
             }
@@ -206,32 +197,32 @@ namespace Orchard.Core.Navigation.Controllers {
                 }
 
                 Logger.Error(T("Creating menu item failed: {0}", exception.Message).Text);
-                Services.Notifier.Error(T("Creating menu item failed: {0}", exception.Message));
+                _notifier.Error(T("Creating menu item failed: {0}", exception.Message));
                 return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
             }
         }
 
         [HttpPost, ActionName("CreateMenuItem")]
         public ActionResult CreateMenuItemPost(string id, int menuId, string returnUrl) {
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
-            var menuPart = Services.ContentManager.New<MenuPart>(id);
+            var menuPart = _contentManager.New<MenuPart>(id);
             if (menuPart == null)
                 return HttpNotFound();
             // load the menu
-            var menu = Services.ContentManager.Get(menuId);
+            var menu = _contentManager.Get(menuId);
             if (menu == null)
                 return HttpNotFound();
 
             menuPart.Menu = menu;
-            var model = Services.ContentManager.UpdateEditor(menuPart, this);
+            var model = _contentManager.UpdateEditor(menuPart, this);
             menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
-            Services.ContentManager.Create(menuPart);
+            _contentManager.Create(menuPart);
             if (!ModelState.IsValid) {
-                Services.TransactionManager.Cancel();
+                _transactionManager.Cancel();
                 return View(model);
             }
-            Services.Notifier.Information(T("Your {0} has been added.", menuPart.TypeDefinition.DisplayName));
+            _notifier.Information(T("Your {0} has been added.", menuPart.TypeDefinition.DisplayName));
             return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
         }
 
@@ -241,7 +232,7 @@ namespace Orchard.Core.Navigation.Controllers {
             if (contentItem == null)
                 return HttpNotFound();
 
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, contentItem.Content.MenuPart.Menu, T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(Permissions.ManageMenus, contentItem.Content.MenuPart.Menu, T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
 
             var model = _contentManager.BuildEditor(contentItem);
@@ -252,19 +243,81 @@ namespace Orchard.Core.Navigation.Controllers {
         [Mvc.FormValueRequired("submit.Save")]
         public ActionResult EditPOST(int id, string returnUrl) {
             return EditPOST(id, returnUrl, contentItem => {
-                if (!contentItem.Has<IPublishingControlAspect>() && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
+                if (!contentItem.Has<IPublishingControlAspect>()
+                    && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable
+                    && contentItem.IsPublished())
                     _contentManager.Publish(contentItem);
             });
         }
-        private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
-            var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
 
-            if (contentItem == null)
+        [HttpPost]
+        // Copy of Contents/AdminController/Publish, but with different permission check and redirect.
+        public ActionResult Publish(int id) {
+            var menuPart = _contentManager.GetLatest<MenuPart>(id);
+            if (menuPart == null)
                 return HttpNotFound();
 
-            if (!Services.Authorizer.Authorize(Permissions.ManageMenus, contentItem.Content.MenuPart.Menu, T("Couldn't manage the main menu")))
+            if (!_authorizer.Authorize(Permissions.ManageMenus, menuPart.Menu, T("Couldn't manage the menu")))
                 return new HttpUnauthorizedResult();
 
+            _contentManager.Publish(menuPart.ContentItem);
+
+            _notifier.Information(
+                string.IsNullOrWhiteSpace(menuPart.MenuText)
+                    ? string.IsNullOrWhiteSpace(menuPart.TypeDefinition.DisplayName)
+                        ? T("Your content has been published.")
+                        : T("Your {0} has been published.", menuPart.TypeDefinition.DisplayName)
+                    : T("'{0}' has been published.", menuPart.MenuText));
+
+            return RedirectToAction("Index", new { menuId = menuPart.Menu.Id });
+        }
+
+        [HttpPost]
+        // Copy of Contents/AdminController/Unpublish, but with different permission check and redirect.
+        public ActionResult Unpublish(int id) {
+            var menuPart = _contentManager.GetLatest<MenuPart>(id);
+            if (menuPart == null)
+                return HttpNotFound();
+
+            if (!_authorizer.Authorize(Permissions.ManageMenus, menuPart.Menu, T("Couldn't manage the menu")))
+                return new HttpUnauthorizedResult();
+
+            _contentManager.Unpublish(menuPart.ContentItem);
+
+            _notifier.Information(
+                string.IsNullOrWhiteSpace(menuPart.MenuText)
+                    ? string.IsNullOrWhiteSpace(menuPart.TypeDefinition.DisplayName)
+                        ? T("Your content has been unpublished.")
+                        : T("Your {0} has been unpublished.", menuPart.TypeDefinition.DisplayName)
+                    : T("'{0}' has been unpublished.", menuPart.MenuText));
+
+            return RedirectToAction("Index", new { menuId = menuPart.Menu.Id });
+        }
+
+        private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart) {
+            return new MenuItemEntry {
+                MenuItemId = menuPart.Id,
+                IsMenuItem = menuPart.Is<MenuItemPart>(),
+                Text = menuPart.MenuText,
+                Position = menuPart.MenuPosition,
+                Url = menuPart.Is<MenuItemPart>()
+                    ? menuPart.As<MenuItemPart>().Url
+                    : _navigationManager.GetUrl(null, _contentManager.GetItemMetadata(menuPart).DisplayRouteValues),
+                ContentItem = menuPart.ContentItem,
+            };
+        }
+
+        private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
+            var menuPart = _contentManager.GetDraftRequired<MenuPart>(id);
+
+            if (menuPart == null)
+                return HttpNotFound();
+
+            if (!_authorizer.Authorize(Permissions.ManageMenus, menuPart.Menu, T("Couldn't manage the menu")))
+                return new HttpUnauthorizedResult();
+
+            var contentItem = menuPart.ContentItem;
+
             string previousRoute = null;
             if (contentItem.Has<IAliasAspect>()
                 && !string.IsNullOrWhiteSpace(returnUrl)
@@ -289,11 +342,22 @@ namespace Orchard.Core.Navigation.Controllers {
                 returnUrl = Url.ItemDisplayUrl(contentItem);
             }
 
-            Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
-                ? T("Your content has been saved.")
-                : T("Your {0} has been saved.", contentItem.TypeDefinition.DisplayName));
+            _notifier.Information(
+                string.IsNullOrWhiteSpace(menuPart.MenuText)
+                    ? string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
+                        ? T("Your content has been saved.")
+                        : T("Your {0} has been saved.", contentItem.TypeDefinition.DisplayName)
+                    : T("'{0}' has been saved.", menuPart.MenuText));
 
-            return this.RedirectLocal(returnUrl, () => RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } }));
+            return RedirectToAction("Index", new { menuId = menuPart.Menu.Id });
+        }
+
+        bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
+            return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
+        }
+
+        void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) {
+            ModelState.AddModelError(key, errorMessage.ToString());
         }
     }
 }
diff --git a/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs b/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
index ea3f94b2f..682df695d 100644
--- a/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
+++ b/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
@@ -19,8 +19,8 @@ namespace Orchard.Core.Navigation.Services {
 
         public IEnumerable<MenuPart> GetMenuParts(int menuId) {
             return _contentManager
-                .Query<MenuPart, MenuPartRecord>()
-                .Where( x => x.MenuId == menuId)
+                .Query<MenuPart, MenuPartRecord>(VersionOptions.Latest)
+                .Where(x => x.MenuId == menuId)
                 .List();
         }
 
diff --git a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
index bcae792ed..7acaa2e2d 100644
--- a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
+++ b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
@@ -1,4 +1,6 @@
 @model NavigationManagementViewModel
+
+@using Orchard.ContentManagement;
 @using Orchard.Core.Navigation.ViewModels;
 @using Orchard.Utility.Extensions;
 
@@ -115,8 +117,21 @@
                     <span class="navigation-position"><input type="text" class="text" name="@Html.NameOf(m => m.MenuItemEntries[i].Position)" value="@menuPartEntry.Position" /></span>
                     <span class="navigation-actions">
                         <input type="hidden" name="@Html.NameOf(m => m.MenuItemEntries[i].MenuItemId)" value="@menuPartEntry.MenuItemId" />
-                        @Html.ItemEditLink(T("Edit").Text, menuPartEntry.ContentItem, new { returnUrl = Request.RawUrl })@T(" | ")
-                        @Html.Link(T("Delete").Text, Url.ItemRemoveUrl(menuPartEntry.ContentItem,null), new { itemprop = "RemoveUrl UnsafeUrl" })
+                        @{
+                            var menuItemHasPublished = menuPartEntry.ContentItem.HasPublished();
+                        }
+
+                        @Html.Link(
+                            menuItemHasPublished ? T("Unpublish").Text : T("Publish").Text,
+                            Url.Action(
+                                menuItemHasPublished ? "Unpublish": "Publish",
+                                "Admin",
+                                new { area = "Navigation", id = menuPartEntry.ContentItem.Id }),
+                            new { itemprop = "UnsafeUrl" })
+                        @T(" | ")
+                        @Html.ItemEditLink(T("Edit").Text, menuPartEntry.ContentItem, new { returnUrl = Request.RawUrl })
+                        @T(" | ")
+                        @Html.Link(T("Delete").Text, Url.ItemRemoveUrl(menuPartEntry.ContentItem, null), new { itemprop = "RemoveUrl UnsafeUrl" })
                     </span>
                 </div>
             

From ebae790f15b68cdfad172e3661d7a19924591dce Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Fri, 6 Dec 2024 14:14:57 +0100
Subject: [PATCH 5/9] #8276: Updating Npgsql to 4.0.17 and fixing setup with
 PostgreSQL (#8810)

* Updating Npgsql to version 4.0.17 (the latest minor version of the closest major version that isn't vulnerable)

https://github.com/OrchardCMS/Orchard/security/dependabot/54

* Fixing that Projection Migrations created indexes with the same name in different tables, which is not supported by PostgreSQL
---
 .../Modules/Orchard.Projections/Migrations.cs | 70 ++++++++++++-------
 src/Orchard.Web/Orchard.Web.csproj            | 26 +++++--
 src/Orchard.Web/packages.config               |  8 ++-
 3 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs
index cf0b6f57e..fbcc658ed 100644
--- a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs
@@ -72,17 +72,7 @@ namespace Orchard.Projections {
             SchemaBuilder.CreateTable("FieldIndexPartRecord", table => table.ContentPartRecord());
 
             //Adds indexes for better performances in queries
-            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
+            AddPropertyNameAndFieldIndexPartRecordIdIndexes();
 
             // Query
 
@@ -287,7 +277,7 @@ namespace Orchard.Projections {
                 Description = T("The text from the Body part").Text
             });
 
-            return 6;
+            return 8;
         }
 
         public int UpdateFrom1() {
@@ -343,17 +333,7 @@ namespace Orchard.Projections {
             .AddColumn<decimal>("LatestValue"));
 
             //Adds indexes for better performances in queries
-            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
-
-            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" }));
-            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" }));
+            AddPropertyNameAndFieldIndexPartRecordIdIndexes();
 
             SchemaBuilder.AlterTable("QueryPartRecord", table => table
                 .AddColumn<string>("VersionScope", c => c.WithLength(15)));
@@ -386,5 +366,47 @@ namespace Orchard.Projections {
 
             return 7;
         }
+
+        public int UpdateFrom7() {
+            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => {
+                table.DropIndex("IX_PropertyName");
+                table.DropIndex("IX_FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => {
+                table.DropIndex("IX_PropertyName");
+                table.DropIndex("IX_FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => {
+                table.DropIndex("IX_PropertyName");
+                table.DropIndex("IX_FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => {
+                table.DropIndex("IX_PropertyName");
+                table.DropIndex("IX_FieldIndexPartRecord_Id");
+            });
+
+            AddPropertyNameAndFieldIndexPartRecordIdIndexes();
+
+            return 8;
+        }
+
+        private void AddPropertyNameAndFieldIndexPartRecordIdIndexes() {
+            SchemaBuilder.AlterTable("StringFieldIndexRecord", table => {
+                table.CreateIndex("IDX_StringFieldIndexRecord_PropertyName", "PropertyName");
+                table.CreateIndex("IDX_StringFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => {
+                table.CreateIndex("IDX_IntegerFieldIndexRecord_PropertyName", "PropertyName");
+                table.CreateIndex("IDX_IntegerFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => {
+                table.CreateIndex("IDX_DoubleFieldIndexRecord_PropertyName", "PropertyName");
+                table.CreateIndex("IDX_DoubleFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id");
+            });
+            SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => {
+                table.CreateIndex("IDX_DecimalFieldIndexRecord_PropertyName", "PropertyName");
+                table.CreateIndex("IDX_DecimalFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id");
+            });
+        }
     }
-}
\ No newline at end of file
+}
diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj
index 563f9d6ba..cf56d91b1 100644
--- a/src/Orchard.Web/Orchard.Web.csproj
+++ b/src/Orchard.Web/Orchard.Web.csproj
@@ -72,17 +72,14 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
-      <HintPath>..\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
-    </Reference>
     <Reference Include="MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
       <HintPath>..\packages\MySql.Data.6.7.9\lib\net45\MySql.Data.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
-    <Reference Include="Npgsql, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
-      <HintPath>..\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
+    <Reference Include="Npgsql, Version=4.0.17.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
+      <HintPath>..\packages\Npgsql.4.0.17\lib\net451\Npgsql.dll</HintPath>
     </Reference>
     <Reference Include="NuGet.Core, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\Orchard.NuGet.Core.1.1.0.0\lib\NuGet.Core.dll</HintPath>
@@ -91,6 +88,9 @@
       <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
+    </Reference>
     <Reference Include="System.Data" />
     <Reference Include="System.ComponentModel.DataAnnotations">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -100,7 +100,23 @@
       <HintPath>..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
     <Reference Include="System.ServiceModel" />
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
+    </Reference>
     <Reference Include="System.Web.ApplicationServices" />
     <Reference Include="System.Web.DynamicData" />
     <Reference Include="System.Web.Entity" />
diff --git a/src/Orchard.Web/packages.config b/src/Orchard.Web/packages.config
index a3cf9084f..750cc0a62 100644
--- a/src/Orchard.Web/packages.config
+++ b/src/Orchard.Web/packages.config
@@ -11,7 +11,13 @@
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
   <package id="MySql.Data" version="6.7.9" targetFramework="net48" />
   <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
-  <package id="Npgsql" version="2.2.3" targetFramework="net48" />
+  <package id="Npgsql" version="4.0.17" targetFramework="net48" />
   <package id="Orchard.NuGet.Core" version="1.1.0.0" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
+  <package id="System.Buffers" version="4.4.0" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.3" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net48" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
 </packages>
\ No newline at end of file

From e68d25e46d0bda654aa62aee1ae84f3d4098b9a1 Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Sun, 8 Dec 2024 13:58:44 +0100
Subject: [PATCH 6/9] Fixing merge and consolidating NuGet packages

---
 src/Orchard.Specs/App.Config                         |  8 ++++++++
 .../Orchard.Tests.Modules.csproj                     |  1 +
 src/Orchard.Web.Tests/app.config                     |  8 ++++++++
 .../Core/Navigation/Controllers/AdminController.cs   |  2 --
 .../CodeGenerationTemplates/ModuleTestsCsProj.txt    | 10 ++++++++--
 .../ModuleTestsPackagesConfig.txt                    |  4 +++-
 .../Orchard.ContentPreview.csproj                    |  2 +-
 .../Modules/Orchard.ContentPreview/packages.config   |  2 +-
 .../Modules/Orchard.Glimpse/Orchard.Glimpse.csproj   |  2 +-
 .../Modules/Orchard.Glimpse/packages.config          |  2 +-
 .../Orchard.MediaLibrary.WebSearch.csproj            |  2 +-
 .../Orchard.MediaLibrary.WebSearch/packages.config   |  2 +-
 .../Modules/Orchard.OpenId/Orchard.OpenId.csproj     |  2 +-
 .../Modules/Orchard.OpenId/packages.config           |  2 +-
 .../Modules/Orchard.Roles/Orchard.Roles.csproj       |  2 +-
 .../Modules/Orchard.Roles/packages.config            |  4 ++--
 src/Orchard.Web/Orchard.Web.csproj                   | 12 ++++++------
 src/Orchard.Web/Web.config                           |  8 ++++++++
 src/Orchard.Web/packages.config                      |  8 ++++----
 19 files changed, 57 insertions(+), 26 deletions(-)

diff --git a/src/Orchard.Specs/App.Config b/src/Orchard.Specs/App.Config
index 05fd3dbfc..2805ca3df 100644
--- a/src/Orchard.Specs/App.Config
+++ b/src/Orchard.Specs/App.Config
@@ -42,6 +42,14 @@
         <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
 <specFlow>
diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
index ae9957c2b..587e740e8 100644
--- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
+++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj
@@ -138,6 +138,7 @@
       <HintPath>..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="System.IO.Compression" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Transactions" />
     <Reference Include="System.Web" />
diff --git a/src/Orchard.Web.Tests/app.config b/src/Orchard.Web.Tests/app.config
index 852be14ac..6b5c5dcfb 100644
--- a/src/Orchard.Web.Tests/app.config
+++ b/src/Orchard.Web.Tests/app.config
@@ -34,6 +34,14 @@
         <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
 </configuration>
diff --git a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
index 5bc2b91c6..6ecc0cbe0 100644
--- a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
@@ -1,9 +1,7 @@
 using System;
-using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web.Mvc;
-using System.Web.Routing;
 using Orchard.ContentManagement;
 using Orchard.ContentManagement.Aspects;
 using Orchard.ContentManagement.Handlers;
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
index 85d91e873..ea96491a7 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsCsProj.txt
@@ -41,8 +41,14 @@
     <Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
+    <Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
+    </Reference>
+    <Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="Remotion.Linq.EagerFetching, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Remotion.Linq.EagerFetching.2.2.0\lib\net45\Remotion.Linq.EagerFetching.dll</HintPath>
     </Reference>
     <Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt
index 6b79f20b1..2bc885670 100644
--- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt
+++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/ModuleTestsPackagesConfig.txt
@@ -2,6 +2,8 @@
 <packages>
   <package id="Autofac" version="3.5.2" targetFramework="net48" />
   <package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
-  <package id="NHibernate" version="4.1.2.4000" targetFramework="net48" />
+  <package id="NHibernate" version="5.5.2" targetFramework="net48" />
+  <package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
+  <package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
   <package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentPreview/Orchard.ContentPreview.csproj b/src/Orchard.Web/Modules/Orchard.ContentPreview/Orchard.ContentPreview.csproj
index 1db70111c..51ca1d54b 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentPreview/Orchard.ContentPreview.csproj
+++ b/src/Orchard.Web/Modules/Orchard.ContentPreview/Orchard.ContentPreview.csproj
@@ -70,7 +70,7 @@
       <Private>True</Private>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.ContentPreview/packages.config b/src/Orchard.Web/Modules/Orchard.ContentPreview/packages.config
index 64f769b11..9ebf8e412 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentPreview/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.ContentPreview/packages.config
@@ -9,6 +9,6 @@
   <package id="Microsoft.Owin.Host.SystemWeb" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Owin.Security" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Glimpse/Orchard.Glimpse.csproj b/src/Orchard.Web/Modules/Orchard.Glimpse/Orchard.Glimpse.csproj
index 3d96c1ede..57dc00d47 100644
--- a/src/Orchard.Web/Modules/Orchard.Glimpse/Orchard.Glimpse.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Glimpse/Orchard.Glimpse.csproj
@@ -93,7 +93,7 @@
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.Glimpse/packages.config b/src/Orchard.Web/Modules/Orchard.Glimpse/packages.config
index d270e01bd..1016476d1 100644
--- a/src/Orchard.Web/Modules/Orchard.Glimpse/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Glimpse/packages.config
@@ -17,7 +17,7 @@
   <package id="Microsoft.Owin.Host.SystemWeb" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Owin.Security" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="5.5.2" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
   <package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/Orchard.MediaLibrary.WebSearch.csproj b/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/Orchard.MediaLibrary.WebSearch.csproj
index a0ad8e13e..8ba3b6265 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/Orchard.MediaLibrary.WebSearch.csproj
+++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/Orchard.MediaLibrary.WebSearch.csproj
@@ -70,7 +70,7 @@
       <Private>True</Private>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/packages.config b/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/packages.config
index 1909aa2de..0d0c84214 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary.WebSearch/packages.config
@@ -11,7 +11,7 @@
   <package id="Microsoft.Owin.Host.SystemWeb" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Owin.Security" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
   <package id="RestEase" version="1.4.9" targetFramework="net48" />
 </packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.OpenId/Orchard.OpenId.csproj b/src/Orchard.Web/Modules/Orchard.OpenId/Orchard.OpenId.csproj
index afa5289d6..7e2f6ac11 100644
--- a/src/Orchard.Web/Modules/Orchard.OpenId/Orchard.OpenId.csproj
+++ b/src/Orchard.Web/Modules/Orchard.OpenId/Orchard.OpenId.csproj
@@ -149,7 +149,7 @@
       <Private>True</Private>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
diff --git a/src/Orchard.Web/Modules/Orchard.OpenId/packages.config b/src/Orchard.Web/Modules/Orchard.OpenId/packages.config
index e9c55374d..fe8ac6636 100644
--- a/src/Orchard.Web/Modules/Orchard.OpenId/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.OpenId/packages.config
@@ -33,7 +33,7 @@
   <package id="Microsoft.Owin.Security.OpenIdConnect" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Owin.Security.Twitter" version="4.2.2" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="NHibernate" version="5.5.2" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
   <package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
index 47ae87ddf..82fab8a1a 100644
--- a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
@@ -60,7 +60,7 @@
       <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
diff --git a/src/Orchard.Web/Modules/Orchard.Roles/packages.config b/src/Orchard.Web/Modules/Orchard.Roles/packages.config
index d8ef6eca5..4edd53141 100644
--- a/src/Orchard.Web/Modules/Orchard.Roles/packages.config
+++ b/src/Orchard.Web/Modules/Orchard.Roles/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
-</packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>
\ No newline at end of file
diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj
index 867da362a..2a0328d58 100644
--- a/src/Orchard.Web/Orchard.Web.csproj
+++ b/src/Orchard.Web/Orchard.Web.csproj
@@ -95,8 +95,8 @@
       <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
     </Reference>
     <Reference Include="System" />
-    <Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
     </Reference>
     <Reference Include="System.Data" />
     <Reference Include="System.ComponentModel.DataAnnotations">
@@ -108,14 +108,14 @@
       <Private>True</Private>
     </Reference>
     <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
+      <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
     </Reference>
     <Reference Include="System.Numerics" />
-    <Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
     </Reference>
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
diff --git a/src/Orchard.Web/Web.config b/src/Orchard.Web/Web.config
index f09cefc7d..2a9fe8447 100644
--- a/src/Orchard.Web/Web.config
+++ b/src/Orchard.Web/Web.config
@@ -265,6 +265,14 @@
         <assemblyIdentity name="Microsoft.IdentityModel.Protocols" publicKeyToken="31bf3856ad364e35" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
   <!-- Registering Roslyn as a compiler for Dynamic Compilation. -->
diff --git a/src/Orchard.Web/packages.config b/src/Orchard.Web/packages.config
index c73b70434..115a00a16 100644
--- a/src/Orchard.Web/packages.config
+++ b/src/Orchard.Web/packages.config
@@ -17,10 +17,10 @@
   <package id="Npgsql" version="4.0.17" targetFramework="net48" />
   <package id="Orchard.NuGet.Core" version="1.1.0.0" targetFramework="net48" />
   <package id="Owin" version="1.0" targetFramework="net48" />
-  <package id="System.Buffers" version="4.4.0" targetFramework="net48" />
-  <package id="System.Memory" version="4.5.3" targetFramework="net48" />
-  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net48" />
-  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
   <package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
   <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
 </packages>
\ No newline at end of file

From 1aec856831a80a2d546b2898094c68af028e3edf Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Sun, 8 Dec 2024 19:37:09 +0100
Subject: [PATCH 7/9] Code and comment styling in MainMenuService and
 LinkFieldDriver

---
 .../Navigation/Services/MainMenuService.cs    | 10 ++---
 .../Orchard.Fields/Drivers/LinkFieldDriver.cs | 43 ++++++++++---------
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs b/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
index 682df695d..24fe9f8d5 100644
--- a/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
+++ b/src/Orchard.Web/Core/Navigation/Services/MainMenuService.cs
@@ -25,7 +25,7 @@ namespace Orchard.Core.Navigation.Services {
         }
 
         public IContent GetMenu(string menuName) {
-            if(string.IsNullOrWhiteSpace(menuName)) {
+            if (string.IsNullOrWhiteSpace(menuName)) {
                 return null;
             }
 
@@ -37,7 +37,7 @@ namespace Orchard.Core.Navigation.Services {
         }
 
         public IContent GetMenu(int menuId) {
-            return _contentManager.Get(menuId, VersionOptions.Published);    
+            return _contentManager.Get(menuId, VersionOptions.Published);
         }
 
         public MenuPart Get(int menuPartId) {
@@ -45,11 +45,11 @@ namespace Orchard.Core.Navigation.Services {
         }
 
         public IContent Create(string name) {
-            
-            if(string.IsNullOrWhiteSpace(name)) {
+
+            if (string.IsNullOrWhiteSpace(name)) {
                 throw new ArgumentNullException(name);
             }
-            
+
             var menu = _contentManager.Create("Menu");
             menu.As<TitlePart>().Title = name;
 
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
index 7f619fb92..73737fe91 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
@@ -1,12 +1,10 @@
-using Orchard.ContentManagement;
+using System;
+using Orchard.ContentManagement;
 using Orchard.ContentManagement.Drivers;
 using Orchard.ContentManagement.Handlers;
 using Orchard.Fields.Fields;
 using Orchard.Fields.Settings;
 using Orchard.Localization;
-using System;
-using System.Collections.Generic;
-using System.Security.Policy;
 
 namespace Orchard.Fields.Drivers {
     public class LinkFieldDriver : ContentFieldDriver<LinkField> {
@@ -60,28 +58,33 @@ namespace Orchard.Fields.Drivers {
                 }
                 else if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) {
                     updater.AddModelError(GetPrefix(field, part), T("Text is required for {0}.", T(field.DisplayName)));
-                } else if (!String.IsNullOrWhiteSpace(field.Value)) {
-                    // Check if it's a valid uri, considering that there may be the link to an anchor only
-                    // e.g.: field.Value = "#divId"
-                    // Take everything before the first "#" character and check if it's a valid uri.
-                    // If there is no character before the first "#", consider the value as a valid one (because it is a reference to a div inside the same page)
+                }
+                else if (!String.IsNullOrWhiteSpace(field.Value)) {
+                    // Check if it's a valid URI, considering that there may be the link to an anchor only, e.g.,
+                    // field.Value = "#divId".
+                    // Take everything before the first "#" character and check if it's a valid URI. If there is no
+                    // character before the first "#", consider the value as a valid one (because it is a reference to
+                    // a div inside the same page).
                     if (field.Value.StartsWith("#")) {
-                        // The field value is a tag id reference
-                        // For html 5, a tag id is valid as long as it doesn't contain white spaces
+                        // The field value is a tag id reference.
+                        // For HTML 5, a tag id is valid as long as it doesn't contain white spaces.
                         if (field.Value.IndexOf(' ') >= 0) {
-                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
+                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
                         }
-                    } else {
+                    }
+                    else {
                         var urlAndRef = field.Value.Split(new char[] { '#' }, 2);
 
-                        // Since field value is a proper url and not a tag id only, assume the first part of the array is the actual url to link to
+                        // Since field value is a proper URL and not a tag id only, assume the first part of the array
+                        // is the actual URL to link to.
                         if (!String.IsNullOrWhiteSpace(urlAndRef[0]) && !Uri.IsWellFormedUriString(urlAndRef[0], UriKind.RelativeOrAbsolute)) {
-                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
-                        } else if (urlAndRef.Length > 1) {
-                            // The second part of the url is the id reference
-                            // For html 5, a tag id is valid as long as it doesn't contain white spaces
+                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
+                        }
+                        else if (urlAndRef.Length > 1) {
+                            // The second part of the URL is the id reference.
+                            // For HTML 5, a tag id is valid as long as it doesn't contain white spaces.
                             if (urlAndRef[1].IndexOf(' ') >= 0) {
-                                updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
+                                updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
                             }
                         }
                     }
@@ -112,7 +115,7 @@ namespace Orchard.Fields.Drivers {
         protected override void Describe(DescribeMembersContext context) {
             context
                 .Member("Text", typeof(string), T("Text"), T("The text of the link."))
-                .Member(null, typeof(string), T("Url"), T("The url of the link."))
+                .Member(null, typeof(string), T("Url"), T("The URL of the link."))
                 .Enumerate<LinkField>(() => field => new[] { field.Value });
         }
     }

From 7dbc8110fa2055eaf3c1762127e304066de0308c Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Sun, 8 Dec 2024 19:37:53 +0100
Subject: [PATCH 8/9] Fixing notification types in the Navigation
 AdminController for Save, Publish, Unpublish

---
 .../Core/Navigation/Controllers/AdminController.cs          | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
index 6ecc0cbe0..cdd79e4ef 100644
--- a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
@@ -261,7 +261,7 @@ namespace Orchard.Core.Navigation.Controllers {
 
             _contentManager.Publish(menuPart.ContentItem);
 
-            _notifier.Information(
+            _notifier.Success(
                 string.IsNullOrWhiteSpace(menuPart.MenuText)
                     ? string.IsNullOrWhiteSpace(menuPart.TypeDefinition.DisplayName)
                         ? T("Your content has been published.")
@@ -283,7 +283,7 @@ namespace Orchard.Core.Navigation.Controllers {
 
             _contentManager.Unpublish(menuPart.ContentItem);
 
-            _notifier.Information(
+            _notifier.Success(
                 string.IsNullOrWhiteSpace(menuPart.MenuText)
                     ? string.IsNullOrWhiteSpace(menuPart.TypeDefinition.DisplayName)
                         ? T("Your content has been unpublished.")
@@ -341,7 +341,7 @@ namespace Orchard.Core.Navigation.Controllers {
                 returnUrl = Url.ItemDisplayUrl(contentItem);
             }
 
-            _notifier.Information(
+            _notifier.Success(
                 string.IsNullOrWhiteSpace(menuPart.MenuText)
                     ? string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
                         ? T("Your content has been saved.")

From 20de85e5b68e5cce581dd9d7b380376a534cf5e8 Mon Sep 17 00:00:00 2001
From: Benedek Farkas <benedek.farkas@lombiq.com>
Date: Sun, 8 Dec 2024 20:19:49 +0100
Subject: [PATCH 9/9] Simplifying LinkFieldDriver validation of URL and
 fragment

---
 .../Orchard.Fields/Drivers/LinkFieldDriver.cs | 57 ++++++++-----------
 1 file changed, 23 insertions(+), 34 deletions(-)

diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
index 73737fe91..58e8817b0 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
@@ -38,10 +38,10 @@ namespace Orchard.Fields.Drivers {
                 () => {
                     if (part.IsNew()) {
                         var settings = field.PartFieldDefinition.Settings.GetModel<LinkFieldSettings>();
-                        if (String.IsNullOrEmpty(field.Value)) {
+                        if (string.IsNullOrEmpty(field.Value)) {
                             field.Value = settings.DefaultValue;
                         }
-                        if (String.IsNullOrEmpty(field.Text)) {
+                        if (string.IsNullOrEmpty(field.Text)) {
                             field.Text = settings.TextDefaultValue;
                         }
                     }
@@ -53,41 +53,30 @@ namespace Orchard.Fields.Drivers {
             if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
                 var settings = field.PartFieldDefinition.Settings.GetModel<LinkFieldSettings>();
 
-                if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
-                    updater.AddModelError(GetPrefix(field, part), T("Url is required for {0}.", T(field.DisplayName)));
+                if (settings.Required && string.IsNullOrWhiteSpace(field.Value)) {
+                    updater.AddModelError(GetPrefix(field, part), T("URL is required for {0}.", T(field.DisplayName)));
                 }
-                else if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) {
-                    updater.AddModelError(GetPrefix(field, part), T("Text is required for {0}.", T(field.DisplayName)));
-                }
-                else if (!String.IsNullOrWhiteSpace(field.Value)) {
-                    // Check if it's a valid URI, considering that there may be the link to an anchor only, e.g.,
-                    // field.Value = "#divId".
-                    // Take everything before the first "#" character and check if it's a valid URI. If there is no
-                    // character before the first "#", consider the value as a valid one (because it is a reference to
-                    // a div inside the same page).
-                    if (field.Value.StartsWith("#")) {
-                        // The field value is a tag id reference.
-                        // For HTML 5, a tag id is valid as long as it doesn't contain white spaces.
-                        if (field.Value.IndexOf(' ') >= 0) {
-                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
-                        }
-                    }
-                    else {
-                        var urlAndRef = field.Value.Split(new char[] { '#' }, 2);
+                else if (!string.IsNullOrWhiteSpace(field.Value)) {
+                    // If the URL contains a fragment identifier (#), find its index to validate the URL and fragment separately.
+                    var fragmentIndex = field.Value.IndexOf('#');
 
-                        // Since field value is a proper URL and not a tag id only, assume the first part of the array
-                        // is the actual URL to link to.
-                        if (!String.IsNullOrWhiteSpace(urlAndRef[0]) && !Uri.IsWellFormedUriString(urlAndRef[0], UriKind.RelativeOrAbsolute)) {
-                            updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
-                        }
-                        else if (urlAndRef.Length > 1) {
-                            // The second part of the URL is the id reference.
-                            // For HTML 5, a tag id is valid as long as it doesn't contain white spaces.
-                            if (urlAndRef[1].IndexOf(' ') >= 0) {
-                                updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid URL.", field.Value));
-                            }
-                        }
+                    // The URL is the part of the value before the fragment identifier (#).
+                    var url = fragmentIndex >= 0 ? field.Value.Substring(0, fragmentIndex) : field.Value;
+                    // If the provided value contains a URL (not just a fragment), check if it's a valid URI.
+                    if (!string.IsNullOrEmpty(url) && !Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) {
+                        updater.AddModelError(GetPrefix(field, part), T("'{0}' is an invalid URL.", url));
                     }
+
+                    // The fragment is the part of the value after the fragment identifier (#).
+                    var fragment = fragmentIndex >= 0 ? field.Value.Substring(fragmentIndex + 1) : null;
+                    // If the provided value contains a fragment, check if it contains spaces.
+                    if (!string.IsNullOrEmpty(fragment) && fragment.IndexOf(' ') >= 0) {
+                        updater.AddModelError(GetPrefix(field, part), T("'{0}' is an invalid URL fragment.", fragment));
+                    }
+                }
+
+                if (settings.LinkTextMode == LinkTextMode.Required && string.IsNullOrWhiteSpace(field.Text)) {
+                    updater.AddModelError(GetPrefix(field, part), T("Text is required for {0}.", T(field.DisplayName)));
                 }
             }