The server-side API Controller

Back to Content The angular.js file contains client side code. If you look at the Save() function you can see how you can call server-side code by using AJAX: $http({ method: ‘POST’, url: ‘api/Planning/PostPlanning/’, data: $scope.Planning }) We have defined an API controller named Planning with a method PostPlanning to which we pas the model…

Angular.js Scripting

Back to Content The next piece is the Angular.js script file – Planning.js – which is contained in the Scripts folder. Note that the file starts with a module declaration and then a controller declaration. The controller code starts with statements that show/hide the elements the elements that need to be displayed. I tried to…

Defining the Body HTML

Back to Content Next step is to look at Planning.cshtml. Note that this page doesn’t have a head and a body section. It’s just the html code to implement the body. At the top of the page is some Razor code. What’s important is the statement ViewBag.InitModule. Here you define the Angular Javascript module to…

The client-side MVC Controller

Back to Content Now, let’s look at the MVC HomeController first. Nothing special. From layout.cshtml you reference the MVC controller. The MVC controller returns a View, which is a cshtml page with the same name. So action method Planning, as an example, is linked to Planning.cshtml. using System.Web.Mvc; namespace Nav4PS.Controllers { public class HomeController :…

Defining layout.cshtml

Back to Contents First of all, realise that you have a shared _Layout.cshtml file that is the parent page for all contained webpages. Layout.cshmtl is the only page that has a <head> section, so that’s where I added the CSS file and some Javascript files to include: <head> <meta charset=”utf-8″ /> <title>@ViewBag.Title</title> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″ />…

Azure Website Hosting Options

https://www.microsoftvirtualacademy.com/en-US/training-courses/microsoft-azure-fundamentals-websites-8460 http://bit-do/choose-websites Compare hosting plans. Scenarios and recommendations. Feature comparison Azure Websites Choose Azure Websites 99% of the time (Scott Guthrie) Very little responsibility, but less control (relatively) Support most popular web development frameworks (also non-Microsoft). Frictionless deployment from VisualStudio or FTP. Deploy in seconds, host for free. Very l You get very much out…

WebDeploy parameterization on runtime

Deze post gaat over het parameteriseren van het web deployment package op runtime. De file [projectname].SetParameters.xml wordt automatisch gegenereerd op basis van settings in de web.config en de project settings. Denk bijvoorbeeld aan connectionstrings. Voor aanvullende parameters kun je een file Parameters.xml toevoegen aan de root van je web application. Bij het aanmaken van het…

Get current user

Aanname is dat je Windows Authentication gebruikt met impersonation: Via System.Web heb je toegang tot HttpContext.User.Identity.Name. Dit is de naam van de user on whose behalf the current process is running. De User property geeft programmatic access tot de IPrincipal interfacde. ASP.Net pages hebben standaard een reference naar de System.Web namespace. ‘ Gets the name…