diff --git a/NKC_WF.sln b/NKC_WF.sln index a2ca481..a180a88 100644 --- a/NKC_WF.sln +++ b/NKC_WF.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppData", "AppData\AppData. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersGen", "VersGen\VersGen.csproj", "{175AF851-9AED-4D5F-8571-9CEC8B2D2320}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO", "IO\IO.csproj", "{0990A432-E9A4-45D0-81D6-782B9DC2382E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,6 +36,12 @@ Global {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Debug-LELE|Any CPU.Build.0 = Debug|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.ActiveCfg = Release|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.Build.0 = Release|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug-LELE|Any CPU.ActiveCfg = Debug|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug-LELE|Any CPU.Build.0 = Debug|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NKC_WF/App_Start/FilterConfig.cs b/NKC_WF/App_Start/FilterConfig.cs new file mode 100644 index 0000000..66e972f --- /dev/null +++ b/NKC_WF/App_Start/FilterConfig.cs @@ -0,0 +1,12 @@ +using System.Web.Mvc; + +namespace NKC_WF +{ + public class FilterConfig + { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new HandleErrorAttribute()); + } + } +} diff --git a/NKC_WF/App_Start/RouteConfig.cs b/NKC_WF/App_Start/RouteConfig.cs index 7265de4..534a655 100644 --- a/NKC_WF/App_Start/RouteConfig.cs +++ b/NKC_WF/App_Start/RouteConfig.cs @@ -1,18 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Web; -using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; +using System.Web.Mvc; +using System.Web.Routing; namespace NKC_WF { - public static class RouteConfig + public static class RouteConfig + { + public static void RegisterRoutes(RouteCollection routes) { - public static void RegisterRoutes(RouteCollection routes) - { - var settings = new FriendlyUrlSettings(); - settings.AutoRedirectMode = RedirectMode.Permanent; - routes.EnableFriendlyUrls(settings); - } + var settings = new FriendlyUrlSettings(); + settings.AutoRedirectMode = RedirectMode.Permanent; + routes.EnableFriendlyUrls(settings); + + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); } + } } diff --git a/NKC_WF/App_Start/WebApiConfig.cs b/NKC_WF/App_Start/WebApiConfig.cs new file mode 100644 index 0000000..b650a84 --- /dev/null +++ b/NKC_WF/App_Start/WebApiConfig.cs @@ -0,0 +1,21 @@ +using System.Web.Http; + +namespace NKC_WF +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Servizi e configurazione dell'API Web + + // Route dell'API Web + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} diff --git a/NKC_WF/Global.asax.cs b/NKC_WF/Global.asax.cs index 9a820b6..d36b691 100644 --- a/NKC_WF/Global.asax.cs +++ b/NKC_WF/Global.asax.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Web; +using System.Web.Http; +using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; -using System.Web.Security; -using System.Web.SessionState; namespace NKC_WF { @@ -14,6 +12,9 @@ namespace NKC_WF void Application_Start(object sender, EventArgs e) { // Codice eseguito all'avvio dell'applicazione + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 0300c1e..cee89b0 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -99,6 +99,10 @@ ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll @@ -113,6 +117,36 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll + True + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll + True + + + ..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll + True + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll + True + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll + True + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll + True + @@ -312,7 +346,9 @@ About.aspx + + ASPXCodeBehind @@ -326,6 +362,8 @@ Contact.aspx + + Default.aspx ASPXCodeBehind diff --git a/NKC_WF/Web.config b/NKC_WF/Web.config index caaf284..b752aea 100644 --- a/NKC_WF/Web.config +++ b/NKC_WF/Web.config @@ -318,6 +318,18 @@ + + + + + + + + + + + + @@ -341,7 +353,13 @@ - + + + + + +