Limit access to your Azure Web App by IP address (ASP.NET Core)

Update 12 Sep 2017: You can add IP restrictions to your Web App from Azure Portal now. https://docs.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions

I’m working on a mini-project that should be seen only from inside our company network. This is my first ASP.NET Core project and I’m still kind of lost with the configuration part and there aren’t many examples in stackoverflow how to do this or that with ASP.NET Core. However I managed to do IP restrictions for my ASP.NET Core app running on Azure and here is how I did it. Read more…

 

AngularJS SPA and .NET MVC routing

How hard can it be to do .NET MVC routing properly along with your AngularJS single page app? -Not very hard. Here is how you can do it:

MVC routing in RouteConfig.cs

Most of the guides you find tells you how to handle the routing if you wan’t to have your SPA routes with an app/ or angular/ prefix. For the sake of having as simple URLs as possible and Search Engine Optimization (SEO) you should avoid redundant stuff in URLs.
So what you want to do is to define the MVC Default route first to catch requests for your MVC controllers. In case the request doesn’t match any of your controllers, you should have a “fallback” CatchAllRoute that will hit your AngularController or whatever you have. Read more…

 

LESS with .NET bundling and minification (+Bootstrap)

There are two things you always have to do when building a website or web application: use a CSS preprocessor and bundle and minify your style/script resources. Using a preprocessor makes writing CSS not so horrible and bundling and minification gives you great performance advantages when you minimize your request amount and size.
Bundling and minification is usually done with grunt or gulp.js but in .NET environment you can take advantage of Microsoft ASP.NET Web Optimization Framework.

This guide will tell you how to use LESS as the CSS preprocessor along with bootstrap‘s LESS source and .NET bundling and minification. Read more…