ASP.NET SignalR – Beyond the Chat Application

Last January 30, I talked about ASP.NET SignalR 2.0 and what are the other uses of the technology aside from the chat application that’s widely available in the internet.

The first time I talked about SignalR (Q2 2013) is about the overview of the technology, and how it is used based on the chat application. From that point, I haven’t seen any implementation yet on how can it be used in business applications – a world where I actually work in. Although a quick check now on the project’s SignalR GitHub page, there are some projects/applications published using this technology.

Fortunately, an unfortunate incident that was reported before by a friend was a good business case where this technology can be implemented. The scenario is something like this:

Employee was working on an application where the users are located on multiple locations and multiple timezones. Employee worked with the business partner to schedule the production release of the approved enhancements. Business sent out prior notifications to the departments through e-mail and employee worked on the technical team that will assist in the release. Departments are responsible for cascading this information to their respective units as they are more aware of the specific roles for their group.

The release was made but had to be pulled out minutes after due to business reasons. The time in between the post release and the time it had to be reverted, data corruption happened and these needs to be corrected. It took a long time and large effort to reach out to different users to remediate data fixes.

A root cause analysis was conducted and one of the suggestions is that in the future releases, introduce the app_offline.htm file in the root folder of the application to make sure that no one is actually working on the application on the time of the release.

While the app_offline.htm file effectively excludes everyone from the application (aka “soft offline”), this might be costly for some who are currently working on the application. Either they had to re-upload a large file, re-input lots of data once an abrupt “activation” of the app_offline.htm file is put into place. It would be nice if these people would be notified of the upcoming outage ONLY if there’s a way to identify their current site activity and send them notices as warning to save their changes.

Building up a prototype using SignalR might be useful for these reasons:

  • Current users of the application are considered as “clients” connected to the server. Application administrators don’t need access to the web server just to get the number of users online (through perfmon) OR use an application level variable (and using that nasty Application.Lock() method) that can probably cause performance penalties.
  • I can treat the whole application as a glorified “chat session” and send broadcast messages to all or specific users (more on the sample application). I can send notifications individually or to everyone, as I desire through divs triggered according to events.

In my talk, I used two pages to demonstrate SignalR. It all started with converting a SignalR 1.x application to version SignalR 2.0.x and build the demo from that.

Client Page (signalr-Notification.aspx)

The client page provides three different ways of participating in the application session (or “chat”) – using the current windows identity, a client-input name, or a value taken from the web.config.


Once you have selected your “identity”, you would see a familiar chat window similar to the chat demo. What made this demo different is that you have three functionality that builds on top of the chat demo.

The first two buttons in this page provide notification to all connected users, while the last one just provide notification to the user calling the function. The first button sends notification based on a fixed value. This could either be a standard greeting to those joining the session or any hardcoded value (e.g. name of the application, etc) that you wish to broadcast.

The second button broadcasts value from the web.config file. As indicated in the scenario above, it would have been better if the current users using the application prior the updates be notified that the application would go offline in x number of minutes. Case for example, if the website is scheduled to go offline in a specific time, you can get the value of the offline schedule (date or datetime) from the web.config and broadcast it to the users. This button is quite flexible on what data to broadcast or notify since you have control on what data to display to the connected users.

The third button simply displays how many users are connected to the application at that point. That’s just it. You would know how many people are actually having an active session with the application. Previously on ASP.NET Membership, the basis of number of users online is based on the users’ login session. However, if I say I login and close the browser after authentication, I would still be recognized as “online”.

Admin Page (signalr-Admin.aspx)

Getting through the admin page needs you to be identified again in the system. I just basically reused the first page and added admin-related items.

In the admin page, I displayed all connected users and their corresponding connection IDs. From this point, the “admin” can send individual messages to the user or broadcast to all a message. This is similar to a Facebook notification wherein people associated or a specific person gets notified for an update or message.


The demo files can be downloaded through my Skydrive folder and is provided as is.

There are other enhancements/items that I am working on this project:

  • Ability to return back to the admin who among the users have acknowledged the notification. An event can be raised and capture the current username of the user who clicked the notification.
  • Do a comparative speed/latency test on connections coming from different browsers. Note that SignalR’s mode of transport depends on the type of browser that a user uses to work with the application.

Questions? Feel free to ask them in the comments. 🙂


Extending the ASP.NET CreateUserWizard Control

The CreateUserWizard control (CUW) has been a significant addition to ASP.NET since it has been introduced in ASP.NET 2.0. It simplifies the method of adding users in our web applications without having to write additional lines of code and the information is stored, by default, in a Server Express database file in the App_Data folder of our web application.

In the Security section of the ASP.NET Forums, a lot of times questions have been asked on how to extend the CreateUserWizard control in ways such as adding additional fields in the CUW, and how to use e-mail instead as the user account’s username. Steps to accomplish these are explained below:
Continue reading “Extending the ASP.NET CreateUserWizard Control”

Using MySQL with ASP.NET with Membership and Roles

One of my instructors in college asked me if it’s possible to use MySQL as a storage engine with ASP.NET and likewise use it with membership. I was a bit surprised since I haven’t touched MySQL for quite a long time and while it is possible, I never thought I would be encountering a situation like this.

I already have a WAMP system set-up in my machine, thanks to the XAMPP package for Windows but I only use Mercury in that package for testing sending out of e-mails in my web applications. Further, I have downloaded the latest MySQL connector for .NET applications and so I went.

Firing up Visual Studio 2008, created a .NET 2.0 website and followed this – it worked until step #15. I am not sure if it’s because the version but by default, the MySQL role provider didn’t appear in the website configuration tool. Since the content might change, I got a page print of the current version (as of this writing).

Here are some tips that I will provide:

Continue reading “Using MySQL with ASP.NET with Membership and Roles”

Microsoft WebsiteSpark



If you are a team of independent web developers that build web applications and websites for others, Microsoft has a new program targetting you.  Scott Guthrie, Microsoft Corporation’s VP for the Developer Division has announced the WebSiteSpark program, on top of the two existing start-up programs BizSpark and DreamSpark (for students). This program enables you to get software, support, and business resources from Microsoft at no cost for three years.

In a nutshell, the programs that you can immediately use upon confirmation of enrollment are the following:

  • 3 licenses of Visual Studio 2008 Professional Edition
  • 1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)
  • 2 licenses of Expression Web 3
  • 4 processor licenses of Windows Web Server 2008 R2
  • 4 processor licenses of SQL Server 2008 Web Edition
  • DotNetPanel control panel (enabling easy remote/hosted management of your servers)

For more information, you can check the official announcement of the program here.

Silverlight 3.0 Released!

I am a bit excited with the release of Silverlight 3.0 and while searching the pages of Silverlight, a download link has been made available for the public to get the Released To Web (RTW) version. Likewise, developers can also take advantage of the Silverlight 3.0 SDK though you need to remove any beta pre-RTW Silverlight 3.0 SDK. Aside from that, Silverlight 3.0 Tools for Visual Studio 2008 is also available for download.


Here are some useful links that you can check out (links open in a new window):

Key improvements for the release are grouped into 4 categories:

  • Media: GPU hardware acceleration, new codec support (H.264, AAC, MPEG-4), raw bitstream Audio/Video API, and improved logging for media analytics
  • Graphics: GPU Acceleration and hardware compositing, perspective 3D, bitmap and pixel API, pixel shader effects, and Deep Zoom improvements
  • Application development: Deep linking, navigation and SEO, improved text quality, multi-touch support, 60+ controls available, and library caching support
  • Data: Data-binding improvements, validation error templates, server data push improvements, binary XML networking support, and multi-tier REST data support

Still, I am waiting for the launch of the site See The Light ( It is already 10 July 2009 here in Manila but perhaps the launch of the site would be the time in the US. 🙂


I finally got word from Microsoft that I was renewed as a Microsoft Most Valuable Professional (MVP) for ASP/ASP.NET for another year!

Thank you Microsoft and I hope my contributions did really help a lot of people!  The new fiscal year is exciting starting with Windows 7 as well as Visual Studio 2010.

Windows 7 RC First Impressions

I had the privilege of trying out the 64-bit version of Windows 7 Release Candidate, thanks to my MSDN subscription which is due to expire in the coming months. This is not the first time I tried Windows 7 since I am already trying it during the Beta stage.

Contrary to previous versions of Windows, setting up Windows 7 took me around 22 minutes with few clicks to complete the installation. I opted to test 64-bit this time since I want to maximize the available hardware in my laptop that a 32-bit system won’t be able to fully utilize (that is the OS physically using the whole 4 GB installed in my machine).

A lot of blogs/news articles has been written with regards to the features of Windows 7 so I won’t elaborate/repost them here but since I am more of a developer, I tried setting up the usual tools that I use developing ASP.NET/Silverlight applications.

Continue reading “Windows 7 RC First Impressions”