Cors.ConfigProfiles is here!

Reading Time: 1

After working on my previous blog post, where I had to use the EnableCorsAttribute, I thought: “Why can’t I make profiles for this in the web.config file, like you can for the OutputCacheAttribute?”

Enter my brand new, shiny NuGet package: Cors.ConfigProfiles! It enables you to use the EnableCorsAttribute just like you normally would, but you can also just give it one string parameter which then matches a profile inside the web.config file. So, for example, if you put this attribute on an API controller:

Then you can configure that profile in web.config like so:

And if you want to contribute or just inspect what I did (no unicorns involved though), the code is available on GitHub.

 

Adding an MVC layer on top of a Web API backend

Reading Time: 8 minutes

It might just be me, but I don’t seem to find a lot of examples out there showing how you can have an ASP.NET MVC website as a front end application using a Web API project as the backend service. Especially so when your front end is as basic as possible: I don’t want to end up storing user data twice because I need to request OAuth tokens and store refresh tokens and so on…

If you want to dive into the code that I’ve produced, you can head straight to GitHub and fetch it 🙂
For more explanation, read on.

Continue reading “Adding an MVC layer on top of a Web API backend”