Tag Archives: Identity

Hangfire Dashboard and ASP .NET 5

This article demonstrates how the Hangfire dashboard can be set up in an ASP .NET 5 application including authentication via ASP .NET Identity.

Adding Hangfire Packages

project.json:

Since I am using Hangfire with SQL, I have to add Hangfire itself and Hangfire.SqlServer to the project.json.

Continue reading

302 Redirect VS 401 Unauthorized – ASP .NET 5 Identity

302 API Redirect Problem

If you make a request to a REST service and are not logged in, by default ASP .NET 5 Identity returns a 302 Redirect to login page. This is great if you are visiting the URL of a controller directly. If you make an Ajax request to a specific REST API and are not logged in however, you are also redirected to the login page and instead of the content of the API you will get the content of the login page itself. Probably without even noticing it right away.

So in instance of API calls I would prefer a 401 Unauthorized status code, e.g. $http requests using AngularJS. Here only the Ajax call itself gets redirected, but the URL of the browser remains the same. This means you won’t see that there is an “authentication problem” and you are not redirected to the login page.

Continue reading

ASP .NET 5 Identity with Entity Framework 7 Setup

In this article we will demonstrate how to provide authentication to ASP .NET 5 applications using ASP .NET Identity with Entity Framework 7.

Adding Packages

Add the following package to your ASP .NET project. This will automatically pull in additional required dependencies for ASP .NET Identity.

project.json

Continue reading