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

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…

 

How to secure your ASP.NET Azure Web App

One of the ASP.NET Azure Web applications I’ve been working with is going to be security audited tomorrow and I was “only checking” that everything is OK in my app security-wise. I figured that I should write down a cheat sheet for the future to make sure I have all the configurations needed in place in other apps as well.
Read more…

 

Tips for Microsoft Build attendees

We had quite many ahaa-moments during our trip to Build 2016 in San Francisco and I wish we had figured out certain things beforehand. That gave me an idea to write about tips and lessons learned for people who are attending Microsoft Build or similar events in the future.
Read more…

 

Output .NET MVC bundle content as a string with Razor

Sometimes you might run into situations when you need to output the contents of your style or script bundle as a raw string inline. For example if you need to pass your markup and stylesheets to somewhere else without having any external resources in it, this would be a handy solution.
Read more…

 

Running Jasmine unit tests in your Visual Studio Online build

I couldn’t find thorough enough tutorial of running Jasmine tests in Visual Studio Online build as part of my continuous integration workflow. I struggled for hours to get this work and decided to write a step-by-step guide about how to make it work. Read more…

 

Apply IP restrictions for Azure Cloud Service

Since Azure SDK 2.4 there’s been a possibility to configure IP restrictions for Azure Cloud Services with Access Control List (ACL).

Just add the following to your ServiceConfiguration.Cloud.cscfg. Read more…

 

Hide your .NET MVC site from search engines (robots.txt)

Short story short. Add routes.IgnoreRoute("robots.txt"); to your RouteConfig.cs and add a file called robots.txt to your project root folder.
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…

 

Validate Anti-Forgery Token using AngularJS, TypeScript, ASP.NET MVC and Web API

I’ve used Olav Nybø’s guide as a base for this article.
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…