New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.

Using SignalR with DotNetNuke Modules

This post will provide you with a basic tutorial for utilizing SignalR with custom DotNetNuke Modules. If you want to bypass the blog post go check out the source on GitHub, you can Fork my Repository. The module created here will be very simple, if you want a full blown module with more features be sure to check out the open source DotNetNuke Module SignalRChat, and see it in action at

SignalR is an ASP.NET library for using websockets and long polling in your applications. Basically what this means, is that you can have your web pages (or apps) maintain an open connection with a webserver, passing data back and forth, without having to do standard posts and gets for the content and functions. SignalR is a free library that you can get from and you can DL from right into your Visual Studio projects.

With my new daytime job I had the need to dive deeply into the pool that is SignalR, so I figured what better way to do that than try to create a DotNetNuke module that would use SignalR. There are plenty of Chat examples for SignalR, so I figured that would be a good place to start.

This post assumes you already have a DotNetNuke development environment setup locally at, and that you have my Visual Studio templates installed. If you don’t, head on over to the DNN Wiki

To start, you should create a new DotNetNuke module using my templates,, I used the C# DAL template, but you can use any of the C# templates. The DAL template has less information that will need to be removed than if you use the DAL2 template, the DAL2 template actually has a working sample in it). I called the module I used for this blog DNNSignalR, but you can name yours whatever you want.

Install SignalR

Install SignalR into the project using NUGET. To do this open your Package Manager Console (found under Tools/Library Package Manager) in Visual Studio 2012. In the Console run the following line

Install-Package Microsoft.AspNet.SignalR

This will download the SignalR resources into a Packages folder inside of your module’s folder. SignalR provides a variety of resources that will be utilized, as well as an older version of jQuery which will not be used.

Add a Reference

In your project add a reference to DotNetNuke.Web.DLL in the website’s BIN folder, this will allow you to use the Route Mapping in DNN 7.

Map the Route

imageIn order for SignalR to work in DNN7, you need to tell DNN how to handle requests to the path /signalr/hubs/ that path won’t physically exist, due to the way the service framework in DNN7 works this is actually very easy to do.

Add a class to your project called RouteMapper.cs using the code in the screenshot here. (In the sample code check out the /components folder)

Note: If you are using URLMaster, you will need to add |/signalr to the end of the doNotRewriteRegex setting on the Regex Settings tab of the URLMaster Friendly URL Settings module (under the HOST menu).

Create the ChatHub

imageThe ChatHub.cs class will be the listener on the SignalR side, “clients” (the view of the module) will send to that chathub using the Send method. The Hub will then broadcast that information back out to all connected clients using the addMessage javascript function, implemented in view.ascx later in this post. In this example ChatHub is really simple, but you’ll find that this class will likely be fairly complex as you start to build our the ability to send messages to different “Groups”, which is supported by SignalR.

Creating the View Control

The View Control in this DotNetNuke module is going to be pretty simple, but it also does everything for the module. It will communicate with the ChatHub, with communication happening in both directions. The first thing we’re going to add to the View control are two JS references. You can do this in a number of ways with DotNetNuke, but the easiest way (not necessarily the best) is to just put them in the ASCX file


imageAfter that we’re going to add the JavaScript that communicates with the ChatHub. The important parts here are the addMessage definition, which will be called by the Hub when a clients submits a chat message, and the start() method which we fire and then wire up the click handler for the linkSubmit hyperlink. The addMessage method will be called by the ChatHub “server” whenever any “client” clicks on the linkSubmit hyperlink. The server sends whatever the messages is to all clients, and it will then be rendered into the browser.

imageThe HTML for the view control is pretty simple, with a single DNN:LABEL control that will tell the user where they can type. The INPUT file will take the message a user wants to send. The Hyperlink linkSubmit will be used for the click event to send the chat message, and finally the UL called “messages” will be used to display the received messages.


imageYou can go ahead and define the fields shown in this screenshot in the app_localresources/view.ascx.resx file, these values will get populated by DNN in the label, and link on the page.

Packaging and Installing the Module

If you created the module using my module development templates, packaging the module is as easy as switching to Release mode in Visual Studio and compiling the module. Then from the DNN host/extensions page upload the module through the Install Extension Wizard. Once you’ve gone through that process you can place the module on a page.

What the Module Does

The module doesn’t do much, it really just takes a text entry and displays it on the page, you’ll need to open the page in two different browser to really test things out. You’ll notice that the messages are pretty simple and won’t tell you who they are from, but that’s okay, it was just quick and dirty sample module. If you want full blown chat functionality check out SignalRChat module demo’d at

Hopefully this at least gets you started with SignalR though, using SignalR you’ll find that you can really empower your DNN modules to be responsive, without having to write a bunch of webservices to do so.

Download the Source

The Source Code samples for this blog post are available on GitHub

Originally posted on, all comments and discussion on this topic should be done there.


hosein norouzi
hi Chris !

tank you for this project !

SignalRChat Project Not Work in dnn7.1.0 (stable version)

404 Not Found - "http://dnn7.1.0/signalr/hubs"

hosein norouzi Friday, July 12, 2013 7:34 AM (link)
Chris Hammond
Hosein, you'll need to do some debugging, that should work fine. It runs on which runs on 7.1
Chris Hammond Friday, July 12, 2013 4:44 PM (link)
hosein norouzi
Chris , i just installed a fresh new dotnetnuke 7.1 and after install DnnChat module but the chat module does not work . any help?

hosein norouzi Sunday, July 14, 2013 4:48 AM (link)
Chris Hammond
@Hosein, this is due to the new Advanced URL handling in DNN 7.1. Right now the only way to fix this is to manually add a DB record. I haven't looked up all the details on the fix yet, but will try to create a blog post tonight covering the details.
Chris Hammond Sunday, July 14, 2013 3:43 PM (link)
Mark Hollas
I am trying to install signalR on an existing project which uses IRouteMapper to map API requests and there seems to be a conflict. Adding the mapping for signalR was no problem but after I added a class inheriting Hub all my API calls return

Unable to locate a controller for Searched in namespaces: DotNetNuke.Modules.GeoLocations.

What would you suggest?

Mark Hollas Thursday, July 25, 2013 4:47 AM (link)
Chris Hammond
Mark, I am not sure what might be causing that.
Chris Hammond Thursday, July 25, 2013 10:24 AM (link)
Mark Hollas
Thanks for getting back to me Chris

I tried the above mentioned setup on your demo project and was able to get the same results.
Mark Hollas Friday, July 26, 2013 1:58 AM (link)
Chris Hammond
For those of you who have had problems with SignalR in 7.1 check out this blog post
Chris Hammond Saturday, July 27, 2013 12:48 AM (link)
Mark Hollas
For my issue I was able to solve by taking "Default" out of mapRouteManager.MapHttpRoute' s parameters and leaving it an empty string.
Mark Hollas Sunday, July 28, 2013 9:17 PM (link)
Ax. Wx.
So I installed two different versions of this module. First, I took source from GITHUB and built it and then installed the zip. I was able to get it installed without issue and then drop it on a pge, but when I navigate tot he page it says it connected to chathub, but I cannot type anything into the box. I click on rooms to Join and it brings up an empty dialog. I uninstalled my compiled version, since the routemapper.cs did not match what was referenced here. I downloaded the already built install and installed it as well, but exact same behavior. Host Settings database entries seem to already be done when I checked. What am I doing wrong? I thought I could just install and drop the extension on a page and then have the I confused?
Ax. Wx. Wednesday, June 18, 2014 5:40 PM (link)
Ax. Wx.
Getting an error int he javascript here in DNNChat.js

r is null

//Room mapping function
function Room(r) {
this.roomId = r.RoomId;
Ax. Wx. Wednesday, June 18, 2014 6:13 PM (link)
Chris Hammond
Ax, visit and if I'm around I can try to answer questions there. Doing so in blog comments won't be the easiest way to get this figured out.
Chris Hammond Thursday, June 19, 2014 11:41 AM (link)
Horacio Judeikin
Any idea how to make SignalR version 2+ work in DNN?
Because " RouteTable.Routes.MapHubs();" is obsolete (cannot be utilized).

What I understood would be the way to go, does not work in DNN.
It would be a class like this:
assembly: OwinStartup(typeof(MyModule.Services.Startup))]
namespace MyModule.Services
public class Startup
public void Configuration(IAppBuilder app)
// Any connection or hub wire up and configuration should go here

I get the 404 for the /hubs .. :(
Horacio Judeikin Tuesday, December 1, 2015 7:21 PM (link)
Horacio Judeikin
Never mind, I think you already have the solution explained here
Horacio Judeikin Tuesday, December 1, 2015 7:24 PM (link)
Horacio Judeikin
I still have a problem, though..
My "public void RegisterRoutes(IMapRoute mapRouteManager)" is not empty, because there are services in use.
I mean, in your module, "RegisterRoutes()" is empty, but in mine is not.
I think this is why "app.MapSignalR();" in Startup() is not being run and therefore I get a 404 error for /signalr/hubs.
Is there any way to make SignalR coexist with the services framework?
Horacio Judeikin Thursday, December 10, 2015 4:58 PM (link)

Comment Form

Only registered users may post comments.


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out