I’m using ASP.NET MVC 4 Internet Site template for this example. When we open layout pages located in shared views folder we can see something like this in layout file header:
<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />
<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/themes/base/css")" rel="stylesheet" type="text/css" />
Let’s take the last line and modify it so it looks like this:
After saving the layout page let’s run browser and see what is coming in over network.
As you can see the request to folder ended up with result code 200 which means that request was successful. 327.2KB was received and it is not mark-up size for error page or directory index. Here is the body of response:
I scrolled down to point where one script ends and another one starts when I made the screenshot above. All scripts delivered with ASP.NET MVC project templates start with this green note. So now we can be sure that the request to scripts folder ended up with bundled script and not with something else.
Script and styles bundling uses currently by default long syntax where bundling is done through Bundling class. We can still avoid those long lines and use extremely short syntax for script and styles bundling – we just write usual script or link tag and give folder URL as source. ASP.NET MVC 4 is smart enough to combine styles or scripts when request like this comes in.
When Windows 8 Consumer Preview came out I downloaded it same day and installed on virtual machine. Of course, I also installed new Visual Studio 11 beta on it. Then I started playing with metro applications and I am very confused and a little bit disappointed about how broken and limited everything will be on WinRT right now. Here are some of my thoughts.
Metro apps are extremely buggy
Over years I have seen no such a pile of bugs in Microsoft product that should be Release Candidate (RC). Windows 7 beta and RC were brilliant. They worked like charm and after couple of weeks with beta I started using it as my main operating system. Okay, there were some small crashed and BSOD-s but still it was extremely stable.
Now Windows 8 is different. Everything else seems to work almost normally but when we start with Metro then everything falls down. Some of my findings are here:
- Suddenly with reason I was not able to identify videos doesn’t play normally in Metro applications. Audio stream is played normally but picture is black. If I run Windows Media Player – this is usual Windows application – on same machine and try to watch videos then everything works fine.
- Problem with video playback exists also on IE10. It doesn’t matter if I run it from desktop or from new start screen. It worked before for some days and then problems started. By the way – Build application fails exactly same way.
- Couple of days more and IE10 doesn’t open from new start screen anymore. It opens for a moment and then shuts down. Best it can do is to stay open and show blue starting screen but nothing more.
- Other Metro apps almost like work. Sometimes they crash, sometimes they are extremely slow and doesn’t react to new mouse gestures. My virtual machine has enough resources to run Windows 8 normally.
I have no good idea what is going on behind curtains or why Microsoft released so buggy version of Windows 8 but considering that they have time about four months to develop + one month to test and debug Windows 8, I am not very sure how bright will be its launch. I mean third-parties need also time to build their apps and test them on stable versions. Thinking this way I am not very sure how competition with Apple iPads will look like or what will be the result.
WinRT API-s: Another bad surprise
Now, let’s go and try to build something useful for my business. Let’s build Metro application that communicates with web services. Is it possible to make something work that uses web services built on previous versions of ASP.NET? Is it possible to use NTLM? Is it possible to use SSL with basic authentication? No, guys, forget it for now. Here are some of my really bad findings:
- Support for ASP.NET web services is completely broken if you need some more advanced features like authentication.
- NTLM authentication doesn’t work. What is more annoying is one blog post I read where one of Microsoft dudes told about Windows authentication in Metro something like this: we don’t plan to support it but if people ask then there will be some support for Windows authentication. Okay, guys, you just made head shot to SharePoint, Office 365 and Dynamix CRM.
- I reconfigured my web services so they use basic authentication. And guess what – again same errors about how communication on socket level fails. When I enabled anonymous access to web services then suddenly I was able to communicate with them. And with me, of course, the whole world.
- There is no way to reference libraries built on working versions of .NET. If you have libraries that do something useful then you have to create special Metro version of them. So you end up with two parallel code-bases that do exactly the same thing. Yes, you are just human being and therefore the worst machine to handle duplications but this is the way how you must live with your Metro applications right now.
I’m not very sure why Windows 8 and Metro development is such a bad mess. I don’t know why it is impossible to build secure business applications on Metro. I really hope that Microsoft is in hurry with many developments on Windows 8 and Consumer Preview was just one unhappy nightly build that was pushed to market. If things are not going way better for a time when stable version is made public then first and most important battle for market is lost for Microsoft.