For the last few weeks I've been feeling a bit nervous with my laptop, the one I use for work and conferences, something was off, sluggier, bloated. Why worry, we have each others back, I'm not going to wipe 4 years of beautiful memories just to get a slimmed down versions (I'm a loyal guy!). The cherry on top happened last Monday at MSDEVMTL, I wanted to show something on the big screen to the audience, so I went to plug the HDMI cable in (the same way I always do) and bang! it happened....blue screen of death (the new one from windows 8...less scary) with a smiley face...ARE YOU KIDDING ME...smiley face in a time of national crisis (ok I admit, I may overreact sometimes). From there everything got more and more awkward between us. After a reboot, Skype for business would stay stuck on the "Starting...." screen and some programs would all of a sudden crash big time.
So I decided that I had no choice but to wipe it and start fresh :(.

A new day

After re-installing Windows 8.1 and EVERYTHING (all the updates and all the apps I use) I tried to start Skype for business... same thing, stuck on "Starting ... " open up sourcetree...crash after less than a minutes, I could not even get Visual Studio 2013 to get past the splash screen without crashing and burning. I was kinda of stuck, but I had a big desktop computer at work...so at least I could still work with this one and get a new laptop soon. I did try a few more times to re-install Windows 8.1 with the bare minimum and nothing would work every app would end up crashing.

A new day .... again

After a few tries I just decided to give up, but then it came to me ... Windows 10 is officially out, might as well give it a go it really can't get worse than that. So I went ahead and installed it, everything went smooth and all of a sudden my dead laptop was snappy and shiny !! But since I was a week of BSOD hell ..... my work desktop (which as only a few months of work done) just went ahead and decided to crash and burn majestically, I mean like a champion ... it took the IT tech more than an hour to get it back up... I'm guessing I had bad karma this week.

Going forward

I really like how snappy the new Windows 10 is, it actually feels like my old computer on Windows 10 is faster than when it was on a brand new Windows 8.1. I t takes a bit of getting used to with the interface and the damn "Start button", but other than that I love it! I'm running VS2013 and VS2015 and I don't feel like I'm asking to much to my computer when I run multiple instances of each...good things. So all in all it looks like I will be on Windows 10 from now on... don't worry if things start to crash, I'll let you guys know :)



I currently work on a project that will be multi-tenant, and our routes use this template http://www.appName.com/clients/{clientName}/ and I was wondering what it would take to have the client name as a subdomain instead of being a parameter in the route template. So I fired up Visual Studio and started a quick project (throwaway of course…) using MVC 5 and WebApi 2.


Creating the route

There are many path available for this scenario, a new route, a constraints, controller inheritance,… I decided to create my own route for this since I wanted the client subdomain to be explicit in the declaration.

The basic code for this is as follow:

public class SubdomainRoute : Route
    public SubdomainRoute(string domain, string url, RouteValueDictionary defaults)
        : this(domain, url, defaults, new MvcRouteHandler())

    public SubdomainRoute(string domain, string url, object defaults)
        : this(domain, url, new RouteValueDictionary(defaults), new MvcRouteHandler())

    public SubdomainRoute(string domain, string url, object defaults, IRouteHandler routeHandler)
        : this(domain, url, new RouteValueDictionary(defaults), routeHandler)

    public SubdomainRoute(string domain, string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
        : base(url, defaults, routeHandler)
        this.Domain = domain;

    public string Domain { get; set; }

    public override RouteData GetRouteData(HttpContextBase httpContext)
        var routeData = base.GetRouteData(httpContext);
        routeData.Values.Add("client", httpContext.Request.Url.Host.Split('.').First());
        return routeData;

The interesting part is in the override of the GetRouteData, we simply call the base class to get all the route data from the template, then we'll check in the Header for the Host param (or directly from the httpContext.Request.Url.Host) . From the host value we can now access the subdomain for this URL, based on this we can do some basic (or complex) logic based on that value….check to see if it's a www value, or if the client's name exists and so on. We also add it the the route data values with the key client.

Registering the routes

In order for this route to exist it must be registered as a route in the route config, so in the routeconfig.cs class I removed the default route registration and added this registration instead:

routes.Add("Subdomain", new SubdomainRoute(
                "{client}.test.local", //of course this should represent the real intent…like I said throwaway demo project in local IIS
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }));

And voilà, now my route is getting picked up by the route config and I can have access to the client value, nice !!!

Oh wait it's not working..but you wrote voilà

Yeah about that… since this a demo project some tinkering is needed, first make sure it is hosted in local IIS and also make sure that your host file will be able to resolve the URL. I havent' found a way to make my host accept a wildcard so I basically just added to entries in it, like if I had two clients (I know business is booming!)    test.local    client1.test.local    client2.test.local

On the other hand if you have access to a staging deployment (hum hum Azure maybe), you could try it as long as you DNS is propertly configured.

  • Ok that's good and all but we are using the latest and greatest!!! Only route attributes for us….. This is in an upcoming post
  • What about WebApi… This is in an upcoming post



If some of you (yes you) we're wondering what was happening with my blog besides some annoucements for @msdevmtl and a few other, here is the quick answer: I got it with the "I'm phony" or the imposter syndrome bug ...hardand I froze!

Little back story on myself

I've been co-organizer for @msdevmtl (http://www.meetup.com/msdevmtl/) for the last 3 years and I just love it, whether I'm doing a session, the welcome intro or attendance at the door it's loads of fun and the entire team is amazing. We are a user group focused on all Microsoft technologies (hence the ms) aimed at developer(the dev part).... based in Montreal(the m...yeah ok I'm sure you figured it out!). So..... after getting myself accustomed to the group and doing a few presentations I was told by this guy named Guy Barrette that I should start blogging and that it would be a good thing, so I did. At first it felt a hard, but the more I did it the easier it got!

Then on the morning of January 1st 2015 I got an email I was waiting for ..... I had been named a Microsoft MVP for ASP.NET/IIS.... I was on top of the world (well my little world at least). A few hours later, as I was going to update my blog to represent that fact (being an MVP, have the MVP badge, do the proper blog entry to thank everyone,....) and it hit me, HARD.... I was now in the same group as these guys @filip_woj, @tjoudeh, @darrel_miller and lots more.....whoa talk about elite!

So of course, that blog entry and the updates to my blog we're never made. I just felt like an imposter, how could I be part of this group, with these guys. I decided to wait a few days to shake it off. Days got to weeks and weeks transformed into months..... until now!

As of now (like today august 19th 2015)

I now think (I should say believe...more self-confidence right?), that I do belong in this group (ok not yet the elite part, but at least in the group). What happened for it to change? First, I'm back at the GSoft office, the company I work with (they are such a great group that I don't considering it "working for" but more "working with"). I also had a very long talk with Darrell Miller back in March during a Montreal MVP get-together and throughout this period I could always count on Guy to remind me to blog, getting me involved as a speaker in MS activities (Azure bootcamp, Web camp) and just general chit-chat. Also I read and re-read those two blog post from Scott Hanselman about being phony and the imposter syndrome and realized that it was not uncommon and that I should must continue what I was doing and just keep getting better at it.

In the coming days this is what I plan on doing:
  • Add more info about me...like the MVP badge, the twitter thing on the side, heck maybe a picture of me (you've been warned)
  • get back to blogging...and have fun while doing it
  • put together at least on presentation for @msdevmtl (ok this one may take more than a few days...but it's in my todo)
If you come back in a few days and nothing has changed....call me out on it! I'll make it easy for you: @matrichard5

The belated thanks

I would like to thank all of those that have been involved with @msdevmtl, @GuyBarrette for the continuous pushing, my family for those times I'm spacing out thinking about code and of course GSoft who has given me every opportunity to achieve this goal.

Until my next blog post.


You can find all the info here:

If you want to have a global look, you can find the road map here : https://github.com/aspnet/home/wiki/roadmap

Key dates are
MilestoneRelease Date
Beta627 Jul 2015
Beta724 Aug 2015
Beta821 Sep 2015
RC1Nov 2015
1.0.0Q1* 2016

RC1 "should be a supported and production ready release"

stay tuned for more