Book Image

SignalR Real-time Application Cookbook

By : Roberto Vespa
Book Image

SignalR Real-time Application Cookbook

By: Roberto Vespa

Overview of this book

Table of Contents (18 chapters)
SignalR Real-time Application Cookbook
About the Author
About the Reviewers

Authorizing requests on a persistent connection

Hubs is generally an easier API to use as compared to Persistent Connection, and that's the case for the authorization process too. With this recipe, we'll see how to provide the same behavior for a persistent connection.

We'll be writing a simple ASP.NET application first, and then we'll add the necessary authorization features to reach the same goal. For the authorization, we'll be using Windows Authentication again, and we'll configure IIS Express accordingly.

Getting ready

Before writing the code of this recipe, we need to create a new empty web application, which we'll call Recipe35.

How to do it…

We first create an empty web application, and we'll make it functional without any authorization bits, which we'll be adding afterwards. We'll perform the following steps:

  1. We start by adding a class named EchoConnection that is derived from PersistentConnection. To do that, we can navigate to Add | New Item… from the context menu of the project entry...