WebFileServer

Details

diff --git a/FileServer/.vs/FileServer/v15/.suo b/FileServer/.vs/FileServer/v15/.suo
index e51711f..d785f49 100644
Binary files a/FileServer/.vs/FileServer/v15/.suo and b/FileServer/.vs/FileServer/v15/.suo differ
diff --git a/FileServer/BLL/App.config b/FileServer/BLL/App.config
index 7e1d79c..15a70c3 100644
--- a/FileServer/BLL/App.config
+++ b/FileServer/BLL/App.config
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-  </configSections>
+  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>
@@ -14,4 +14,4 @@
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
-</configuration>
\ No newline at end of file
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup></configuration>
diff --git a/FileServer/BLL/BLL.csproj b/FileServer/BLL/BLL.csproj
index aff73f9..f7293ff 100644
--- a/FileServer/BLL/BLL.csproj
+++ b/FileServer/BLL/BLL.csproj
@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>BLL</RootNamespace>
     <AssemblyName>BLL</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <Deterministic>true</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -37,6 +38,12 @@
     <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
     </Reference>
+    <Reference Include="JWT, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\JWT.5.2.2\lib\net46\JWT.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Configuration" />
@@ -51,14 +58,15 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Base\BaseServices.cs" />
-    <Compile Include="Services\FSExplorerServices.cs" />
-    <Compile Include="Services\FS_WathcerServices.cs" />
-    <Compile Include="Services\GarbageUploadServices.cs" />
+    <Compile Include="Services\FS\FSExplorerServices.cs" />
+    <Compile Include="Services\FS\FS_WathcerServices.cs" />
+    <Compile Include="Services\System\GarbageUploadServices.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Services\ConfigurationServices.cs" />
-    <Compile Include="Services\PermissionServices.cs" />
-    <Compile Include="Services\ScanServices.cs" />
-    <Compile Include="Services\UploadServices.cs" />
+    <Compile Include="Services\System\PermissionServices.cs" />
+    <Compile Include="Services\FS\ScanServices.cs" />
+    <Compile Include="Services\System\TokenServices.cs" />
+    <Compile Include="Services\FS\UploadServices.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Model\Model.csproj">
@@ -70,5 +78,6 @@
     <None Include="App.config" />
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
diff --git a/FileServer/BLL/packages.config b/FileServer/BLL/packages.config
index d8c7306..d86f135 100644
--- a/FileServer/BLL/packages.config
+++ b/FileServer/BLL/packages.config
@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="EntityFramework" version="6.2.0" targetFramework="net45" />
+  <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
+  <package id="JWT" version="5.2.2" targetFramework="net46" />
+  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
 </packages>
\ No newline at end of file
diff --git a/FileServer/BLL/Services/System/TokenServices.cs b/FileServer/BLL/Services/System/TokenServices.cs
new file mode 100644
index 0000000..da94b92
--- /dev/null
+++ b/FileServer/BLL/Services/System/TokenServices.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using JWT.Algorithms;
+using JWT.Builder;
+using JWT.Serializers;
+
+namespace BLL.Services.System
+{
+    public class TokenData
+    {
+        public int ID { set; get; }
+        public DateTime ValidTime { set; get; }
+
+        public bool IsValid => ValidTime >= DateTime.Now;
+        public long ValidTime_Bin
+        {
+            set => ValidTime = DateTime.FromBinary(value);
+            get => ValidTime.ToBinary();
+        }
+    }
+
+    public class TokenServices
+    {
+        private const string Key = "GQDstcKsx0NHjPOuXOYg5MbeJ1XT0uFiwDVvVBrk";
+
+
+        public string CreateTocken(TokenData data)
+        {
+            return new JwtBuilder()
+                .WithAlgorithm(new HMACSHA256Algorithm())
+                .WithSecret(Key)
+                .AddClaim("ID", data.ID)
+                .AddClaim("ValidTime", data.ValidTime_Bin)
+                .Build();
+        }
+        public string CreateTocken(int ID, TimeSpan LiveTime)
+        {
+            return CreateTocken(new TokenData()
+            {
+                ID = ID,
+                ValidTime = DateTime.Now + LiveTime
+            });
+        }
+
+        public TokenData GetData(string token)
+        {
+            var data = new JwtBuilder()
+                .WithSecret(Key)
+                .MustVerifySignature()
+                .Decode<IDictionary<string, object>>(token);
+
+            return new TokenData()
+            {
+                ID = (int)(long)data["ID"],
+                ValidTime_Bin = (long)data["ValidTime"]
+            };
+        }
+    }
+}
diff --git a/FileServer/Console/App.config b/FileServer/Console/App.config
index af887af..d7e8be5 100644
--- a/FileServer/Console/App.config
+++ b/FileServer/Console/App.config
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-  </configSections>
+    
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
+  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
   <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
   </startup>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>
-        <parameter value="mssqllocaldb" />
+        <parameter value="mssqllocaldb"/>
       </parameters>
     </defaultConnectionFactory>
     <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
     </providers>
   </entityFramework>
 
   <appSettings>
-    <add key="WorkFolder" value="C:\Users\cccc1808\source\repos\FileServer\Console\bin\Debug\Dir1;C:\Users\cccc1808\source\repos\FileServer\Console\bin\Debug\Dir2" />
+    <add key="WorkFolder" value="C:\Users\cccc1808\source\repos\FileServer\Console\bin\Debug\Dir1;C:\Users\cccc1808\source\repos\FileServer\Console\bin\Debug\Dir2"/>
   </appSettings>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/FileServer/Console/Console.csproj b/FileServer/Console/Console.csproj
index f5a7c84..4f3f2de 100644
--- a/FileServer/Console/Console.csproj
+++ b/FileServer/Console/Console.csproj
@@ -8,9 +8,10 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Console</RootNamespace>
     <AssemblyName>Console</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <Deterministic>true</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
diff --git a/FileServer/Console/Program.cs b/FileServer/Console/Program.cs
index ce65d94..5ca23bd 100644
--- a/FileServer/Console/Program.cs
+++ b/FileServer/Console/Program.cs
@@ -8,6 +8,8 @@ using Model.UnitsOfWork;
 using Model.Entities.Files;
 using Model.Entities.Files.FS_Entities;
 using BLL.Services;
+using BLL.Services.FS;
+using BLL.Services.System;
 
 using System.IO;
 using System.Data.Entity;
@@ -118,13 +120,18 @@ namespace Console
 
         static void Main(string[] args)
         {
-            new Context(true);
+            //new Context(true);
+
+            //var UOW = new UOW();
+            //new ConfigurationServices(UOW).ReadConfiguration();
+            //Task.WaitAll(new ScanServices(UOW).ScanAllDirs());
+
+            //var dirs = UOW.Repo_SDirectory.All_List;
 
-            var UOW = new UOW();
-            new ConfigurationServices(UOW).ReadConfiguration();
-            Task.WaitAll(new ScanServices(UOW).ScanAllDirs());
 
-            var dirs = UOW.Repo_SDirectory.All_List;
+            var ts = new TokenServices();
+            var token = ts.CreateTocken(10, new TimeSpan(5, 0,0));
+            var data = ts.GetData(token);
         }
     }
 }
diff --git a/FileServer/Model/App.config b/FileServer/Model/App.config
index 7e1d79c..13ecece 100644
--- a/FileServer/Model/App.config
+++ b/FileServer/Model/App.config
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-  </configSections>
+  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>
diff --git a/FileServer/SPA/SPA.njsproj b/FileServer/SPA/SPA.njsproj
index 872cac6..0254565 100644
--- a/FileServer/SPA/SPA.njsproj
+++ b/FileServer/SPA/SPA.njsproj
@@ -4,7 +4,7 @@
     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
     <Name>SPA</Name>
     <RootNamespace>SPA</RootNamespace>
-    <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
+    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
     <SaveNodeJsSettingsInProjectFile>True</SaveNodeJsSettingsInProjectFile>
   </PropertyGroup>
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
diff --git a/FileServer/Web/BackgroundWorkers/GarbageUploadsWorker.cs b/FileServer/Web/BackgroundWorkers/GarbageUploadsWorker.cs
index 538b7a4..75cda78 100644
--- a/FileServer/Web/BackgroundWorkers/GarbageUploadsWorker.cs
+++ b/FileServer/Web/BackgroundWorkers/GarbageUploadsWorker.cs
@@ -8,7 +8,7 @@ using Quartz;
 using Quartz.Impl;
 
 using Model.UnitsOfWork;
-using BLL.Services;
+using BLL.Services.System;
 
 namespace Web.BackgroundWorkers
 {
diff --git a/FileServer/Web/Controllers/API/AuthController.cs b/FileServer/Web/Controllers/API/AuthController.cs
index 3b7425f..727f083 100644
--- a/FileServer/Web/Controllers/API/AuthController.cs
+++ b/FileServer/Web/Controllers/API/AuthController.cs
@@ -4,11 +4,14 @@ using System.Linq;
 using System.Web;
 using System.Web.Mvc;
 
+using BLL.Services.System;
+
 using Web.Models.Base;
 
 namespace Web.Controllers.API
 {
-    public class AuthResult :  BaseApiResult
+
+    public class AuthResult : BaseApiResult
     {
         public AuthResult(bool Successe, string ResMsg, string Token, string UserName) : base(Successe, ResMsg, "Auth")
         {
@@ -39,16 +42,16 @@ namespace Web.Controllers.API
                 && e.IsActive);
 
             var j = Json(new AuthResult(
-false,
-"Пользователь не найден или заблокирован",
-"", ""));
+                false,
+                "Пользователь не найден или заблокирован",
+                "", ""));
 
             if (user != null)
             {
                 return Json(new AuthResult(
                     true,
                     "",
-                    user.ID.ToString(),
+                    TokenServices.CreateTocken(user.ID, new TimeSpan(1, 0, 0)),
                     user.Login)
                     );
             }
@@ -70,21 +73,19 @@ false,
                 return Json(new AuthResult(
                     true,
                     "",
-                    CurrentUser.ID.ToString(),
-                    CurrentUser.Login)                    
+                    TokenServices.CreateTocken(CurrentUser.ID, new TimeSpan(1, 0, 0)),
+                    CurrentUser.Login)
                     );
             }
             else
             {
                 return Json(new AuthResult(
-                    false, 
+                    false,
                     "Пользователь не найден или заблокирован",
                     "",
                     "")
                     );
             }
         }
-
-
     }
 }
\ No newline at end of file
diff --git a/FileServer/Web/Controllers/API/ExplorerController.cs b/FileServer/Web/Controllers/API/ExplorerController.cs
index 3da616e..42e9459 100644
--- a/FileServer/Web/Controllers/API/ExplorerController.cs
+++ b/FileServer/Web/Controllers/API/ExplorerController.cs
@@ -14,6 +14,7 @@ using Web.Models.Base;
 using Model.Entities.Files;
 using Model.Entities.Files.FS_Entities;
 using BLL.Services;
+using BLL.Services.FS;
 using Model.UnitsOfWork;
 
 namespace Web.Controllers.API
diff --git a/FileServer/Web/Controllers/Base/BaseApiController.cs b/FileServer/Web/Controllers/Base/BaseApiController.cs
index 18bd56e..dc17c0a 100644
--- a/FileServer/Web/Controllers/Base/BaseApiController.cs
+++ b/FileServer/Web/Controllers/Base/BaseApiController.cs
@@ -10,7 +10,7 @@ using System.Configuration;
 using System.IO;
 using System.Web.Script.Serialization;
 
-using BLL.Services;
+using BLL.Services.System;
 using Model.Entities.Users;
 
 namespace Web.Controllers.Base
@@ -19,6 +19,7 @@ namespace Web.Controllers.Base
     {
         protected User CurrentUser { private set; get; }
         protected readonly PermissionServices permissionServices;
+        protected readonly TokenServices TokenServices = new TokenServices();
 
         /// <summary>
         /// Http Post Json request
@@ -55,13 +56,19 @@ namespace Web.Controllers.Base
 
                 if (auth.Value.Count() != 0)
                 {
-                    int ID = -1;
+                    TokenData data = null;
 
-                    if (int.TryParse(auth.Value.First().ToString(), out ID))
-                    {
-                        CurrentUser = UOW.Repo_User.All.
-                            FirstOrDefault(e => e.ID == ID);
-                    }
+                    //try
+                    //{
+                        data = TokenServices.GetData(auth.Value);
+                    //}
+                    //catch { return; }
+
+                    if (!data.IsValid)
+                        return;
+
+                    CurrentUser = UOW.Repo_User.All.
+                        FirstOrDefault(e => e.ID == data.ID);
                 }
 
             }
diff --git a/FileServer/Web/Controllers/Base/BaseController.cs b/FileServer/Web/Controllers/Base/BaseController.cs
index 8b0a356..68616f1 100644
--- a/FileServer/Web/Controllers/Base/BaseController.cs
+++ b/FileServer/Web/Controllers/Base/BaseController.cs
@@ -5,7 +5,7 @@ using System.Web;
 using System.Web.Mvc;
 
 using Model.UnitsOfWork;
-using BLL.Services;
+using BLL.Services.FS;
 
 namespace Web.Controllers.Base
 {
diff --git a/FileServer/Web/Global.asax.cs b/FileServer/Web/Global.asax.cs
index 170bb27..b27a5f7 100644
--- a/FileServer/Web/Global.asax.cs
+++ b/FileServer/Web/Global.asax.cs
@@ -12,6 +12,7 @@ using Web.BackgroundWorkers;
 
 using Model.UnitsOfWork;
 using BLL.Services;
+using BLL.Services.FS;
 
 
 namespace Web
diff --git a/FileServer/Web/packages.config b/FileServer/Web/packages.config
index 189f22a..a292ad0 100644
--- a/FileServer/Web/packages.config
+++ b/FileServer/Web/packages.config
@@ -1,20 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Antlr" version="3.5.0.2" targetFramework="net45" />
-  <package id="EntityFramework" version="6.2.0" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Mvc.ru" version="5.2.7" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Razor.ru" version="3.2.7" targetFramework="net452" />
-  <package id="Microsoft.AspNet.TelemetryCorrelation" version="1.0.5" targetFramework="net452" />
-  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Web.Optimization.ru" version="1.1.3" targetFramework="net45" />
-  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net452" />
-  <package id="Microsoft.AspNet.WebPages.ru" version="3.2.7" targetFramework="net452" />
-  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net452" />
-  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
-  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
-  <package id="Quartz" version="3.0.7" targetFramework="net452" />
-  <package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net452" />
-  <package id="WebGrease" version="1.6.0" targetFramework="net45" />
+  <package id="Antlr" version="3.5.0.2" targetFramework="net46" />
+  <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Mvc.ru" version="5.2.7" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Razor.ru" version="3.2.7" targetFramework="net46" />
+  <package id="Microsoft.AspNet.TelemetryCorrelation" version="1.0.5" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net46" />
+  <package id="Microsoft.AspNet.Web.Optimization.ru" version="1.1.3" targetFramework="net46" />
+  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net46" />
+  <package id="Microsoft.AspNet.WebPages.ru" version="3.2.7" targetFramework="net46" />
+  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net46" />
+  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
+  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net46" />
+  <package id="Quartz" version="3.0.7" targetFramework="net46" />
+  <package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net46" />
+  <package id="WebGrease" version="1.6.0" targetFramework="net46" />
 </packages>
\ No newline at end of file
diff --git a/FileServer/Web/Web.config b/FileServer/Web/Web.config
index 22b2cef..3d208a9 100644
--- a/FileServer/Web/Web.config
+++ b/FileServer/Web/Web.config
@@ -5,9 +5,9 @@
   -->
 <configuration>
   <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-  </configSections>
+  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
   <!--<system.web.extensions>
     <scripting>
       <webServices>
@@ -31,7 +31,7 @@
       </system.Web>
   -->
   <system.web>
-    <compilation debug="true" targetFramework="4.5.2" />
+    <compilation debug="true" targetFramework="4.6" />
     <httpRuntime targetFramework="4.5" />
     <httpModules>
       <add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" />
@@ -78,24 +78,21 @@
       <remove name="TelemetryCorrelationHttpModule" />
       <add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="managedHandler" />
     </modules>
-
-      <rewrite>
-        <rules>
-          <rule name="SPA Routes" stopProcessing="true">
-            <match url=".*" />
-            <conditions logicalGrouping="MatchAll">
-              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
-              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
-              <add input="{REQUEST_URI}" pattern="^/(bundles)" negate="true" />
-              <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />              
-            </conditions>
-            <action type="Rewrite" url="/" />
-          </rule>
-        </rules>
-      </rewrite>
-
-  
-  <validation validateIntegratedModeConfiguration="false" />
+    <rewrite>
+      <rules>
+        <rule name="SPA Routes" stopProcessing="true">
+          <match url=".*" />
+          <conditions logicalGrouping="MatchAll">
+            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
+            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
+            <add input="{REQUEST_URI}" pattern="^/(bundles)" negate="true" />
+            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
+          </conditions>
+          <action type="Rewrite" url="/" />
+        </rule>
+      </rules>
+    </rewrite>
+    <validation validateIntegratedModeConfiguration="false" />
   </system.webServer>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
@@ -107,21 +104,17 @@
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
-
   <connectionStrings>
-
     <!--Sqllocaldb-->
     <add name="DBConnection" connectionString="data source=(localdb)\MSSQLLocalDB;Initial Catalog=FS;Integrated Security=True; MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
-
     <!--MS SQL Express-->
     <!-- .\ - WIN-2016-SERVER -->
     <!--<add name="DBConnection" connectionString="data source=.\SQLEXPRESS;Initial Catalog=MSSQLLocalDB;User ID=SQL_User;Password=link; MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />-->
-
   </connectionStrings>
   <system.codedom>
     <compilers>
-      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
-      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
+      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
     </compilers>
   </system.codedom>
 </configuration>
\ No newline at end of file
diff --git a/FileServer/Web/Web.csproj b/FileServer/Web/Web.csproj
index ac60853..2cf6d73 100644
--- a/FileServer/Web/Web.csproj
+++ b/FileServer/Web/Web.csproj
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
-  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -15,7 +15,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Web</RootNamespace>
     <AssemblyName>Web</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <MvcBuildViews>false</MvcBuildViews>
     <UseIISExpress>true</UseIISExpress>
     <Use64BitIISExpress />
@@ -48,6 +48,9 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
+      <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
+    </Reference>
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
     </Reference>
@@ -61,6 +64,9 @@
       <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.CSharp" />
+    <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.2\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
@@ -71,7 +77,7 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net45\System.Diagnostics.DiagnosticSource.dll</HintPath>
+      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
     </Reference>
     <Reference Include="System.Drawing" />
     <Reference Include="System.Numerics" />
@@ -80,15 +86,18 @@
     <Reference Include="System.Web.Entity" />
     <Reference Include="System.Web.ApplicationServices" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
-    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Abstractions" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
     </Reference>
     <Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
     </Reference>
+    <Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
+    </Reference>
     <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
     </Reference>
@@ -106,26 +115,14 @@
     <Reference Include="System.Configuration" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.EnterpriseServices" />
-    <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <Private>True</Private>
-      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
-    </Reference>
     <Reference Include="System.Net.Http">
     </Reference>
     <Reference Include="System.Net.Http.WebRequest">
     </Reference>
-    <Reference Include="System.Web.Optimization">
-      <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
-    </Reference>
     <Reference Include="System.Xml.Linq" />
-    <Reference Include="WebGrease">
-      <Private>True</Private>
+    <Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
     </Reference>
-    <Reference Include="Antlr3.Runtime">
-      <Private>True</Private>
-      <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
-    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="App_Start\BundleConfig.cs" />
@@ -149,6 +146,7 @@
   <ItemGroup>
     <Content Include="favicon.ico" />
     <Content Include="Global.asax" />
+    <None Include="packages.config" />
     <None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
     <Content Include="Scripts\app_bundle.js" />
     <Content Include="Web.config">
@@ -171,9 +169,6 @@
     <Folder Include="App_Data\" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <ItemGroup>
     <ProjectReference Include="..\BLL\BLL.csproj">
       <Project>{b03d6843-e0cd-4526-990d-0300e8b148ec}</Project>
       <Name>BLL</Name>
@@ -219,7 +214,7 @@
     <PropertyGroup>
       <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
+    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
   </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/FileServer/Web/Web.csproj.user b/FileServer/Web/Web.csproj.user
index c3826ca..6927e1b 100644
--- a/FileServer/Web/Web.csproj.user
+++ b/FileServer/Web/Web.csproj.user
@@ -8,7 +8,7 @@
     <IISExpressWindowsAuthentication />
     <IISExpressUseClassicPipelineMode />
     <UseGlobalApplicationHostFile />
-    <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
+    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
     <Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
     <Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
     <WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>