Quantcast
Channel: BJ Focus Labs
Browsing latest articles
Browse All 22 View Live

Image may be NSFW.
Clik here to view.

How to make sure all projects in a Visual Studio 2013 solution have the same...

I created a Visual Studio 2013 solution with an MVC project and a class project, both created around the same time. The MVC project had a few NuGet packages pre-installed and I added some of them to...

View Article



Image may be NSFW.
Clik here to view.

Validation attributes in Code First

DataAnnotations are really helpful when creating a model in Entity Framework Code-First. They are a simple way of instructing EF how you want the model to be structured and how it should translate the...

View Article

Image may be NSFW.
Clik here to view.

Database related attributes in Code First

This post is a follow-up on the post about Validation attributes in Code-First. While validation attributes focus on making sure the data in the model is correct, the attributes listed here instead...

View Article

Image may be NSFW.
Clik here to view.

Using Json.NET as default JSON serializer in MVC

Returning JSON from an MVC action method is very easy. Just look at this simple example: public JsonResult GetItemData(int itemId) { // ...things to do... var response = new { result = "ok" }; return...

View Article

Image may be NSFW.
Clik here to view.

Create an MVC wrapper for Toastr

Toastr is a great little library for creating user messages on your website. It’s written in JavaScript and is as such platform independent. But if you’re like me (mainly working in ASP.NET MVC) then...

View Article


Image may be NSFW.
Clik here to view.

Extend MVC controller to support Toastr messages

In an earlier post I showed how to create an MVC wrapper for Toastr, a JavaScript library used for displaying user messages in the web browser. In the post I mentioned that there are two ways to make...

View Article

Image may be NSFW.
Clik here to view.

Setting up SSL for Azure Website using GoDaddy

Since a while back it’s now possible to add SSL certificates to your own domains on Azure. However, it’s not like a walk in the park to make it work. It all depends on what SSL provider you’re using. I...

View Article

Running a background thread inside an ASP.NET website

When most people think of a web site or web application they think of something that respond to user navigations. The site has a life cycle that begins when the call comes in and ends when the response...

View Article


Mocking async repository calls

Mocking is a great technique for isolating code that you want to test. By mocking the interfaces a code section depends on you can create an isolation level where only the behavior of this specific...

View Article


Block access to images from other websites

In ASP.NET you can write HTTP Modules to perform actions inside the request pipeline before the request is being finally processed. In this example we use an HTTP Module to check whether the REFERER...

View Article
Browsing latest articles
Browse All 22 View Live




Latest Images