back to article Blazor: Full stack C# and Microsoft's pitch for ASP.NET Web Form diehards

Microsoft is pitching its Blazor framework, the newest addition to the ASP.NET Core platform, as a suitable upgrade for C# developers still wedded to Web Forms, the programming model dating back to the first release of the .NET Framework in 2002. Microsoft thinks Blazor is a good option for developers stuck on the ancient web …

  1. Zippy´s Sausage Factory
    Flame

    Having used both MVC and Web Forms, I'm still not convinced either of them was much of an "upgrade" over "classic" ASP. This just feels a bit worse.

    Personally I'd welcome a .Net version of classic asp, just a JavaScript friendly code-behind-optional model that gets out of your way and doesn't inflict a ton of brain damage on you. You know, a bit like PHP. But do Micros~1 actually want to do that? No. They have traditionally seen their development tools as a great way to lock people into using Micros~1 products, and old habits die hard, it seems.

    Still, at least they're true to their recent behaviour: if there's two ways to do something, come up with a third that isn't quite as good and proclaim it as the future.

    1. StrangerHereMyself Silver badge

      Classic ASP? Are you sh**ting me? The last time I used that was 20 years ago and it nearly wrecked my nerves. I can still see all those "on error resume next" statements when I have a bad night's sleep.

      ASP.NET MVC is simply the best for web apps (in combination with WebAPI in case you use JavaScript frameworks for SPA). I never understood the need for Razor Pages.

      Blazor OTOH is really nice since it imitates the way I used ASP.NET MVC with JQuery, but without me having to code the plumbing myself.

      1. Wibble

        MVC?

        Properly built WebForms actually have the three tiered structure of MVC: code-in-front=View, code-behind=Controller, rules/data tier = Model.

        Unit testing client applications is always fraught because of the complexity of the UI. It's perfectly possible to create unit tests but it's further down the stack.

        BTW 'classic' ASP was pretty good too and enabled people to start with lightweight coding and progress on to more complex projects. Of course .Net was a massive step up in the tools (Visual Studio) and performance. I'm no MS fan boy, but credit where it's due, ASP.NET is one of the best things that ever came out of Microsoft.

        (The date's wrong. ASP.NET was released in 2000 with versions 1.1 and 2.0 soon after. Was developing a large ASP.NET project when 9/11 happened.)

      2. Zippy´s Sausage Factory

        I don't think you've quite followed what I'm saying.

        Classic ASP was horrible to work with, thanks to VBA and COM. Enough to make anyone scream.

        What I'm asking for is a more simplified version of web development - kill off Razor (an awful piece of technology that should be nuked from space).

        Utilize IIS better. Let's have the ability to have our html as embedded resources without a ton of code. Let's have the freedom to have whatever JS library we like on the front end, without Microsoft jamming a ton of cruft in there. Configuration files like packages.config shouldn't live inside my web site - ever.

        I'm not wanting to bring classic ASP back from the dead, but to bring back some of its more openness. Classic ASP felt like an open-world type of thing where you can go anywhere, MVC and Webforms feel to me like one of those adventure games where you type "go west" and it replies "you decide not to, go east instead and get eaten by a grue".

        As for Blazor, the whole idea of serving up just a div and then getting the rest via JavaScript is a total abomination that kills off any attempts at accessibility, usability and probably is horrendous for SEO too. I really have no idea why anyone would write a website like that.

        1. Geoffrey W

          RE: "Configuration files like packages.config shouldn't live inside my web site - ever."

          They don't. They exist in the project, not the web site; they are not web addressable. There is a 'wwwroot' folder and only the files in that end up on the client side. All the sensitive code and stuff remains on the server only. It's an extra level of security; on web forms everything in the project ended up on the client (I think? Not a major web developer).

          RE:'JavaScript is a total abomination '

          JS is THE web programming script language now, so better get over it. In my little Blazor web app I need to have exactly <NULL> JS knowledge. I use Bootstrap, which is mostly JS, and I know absolutely bugger all about how it works. I just need to apply my pre-existing C# skills. Once I climbed the initial learning curve, which wasn't very steep to be honest, I was off and running.

          1. StrangerHereMyself Silver badge

            Bootstrap isn't mostly JS, but CSS.

            Seriously, you call yourself a web developer when you don't know the difference between JS (JavaScript) and CSS?

            I was gonna mention that packages.config too, but you beat me to it. I was wondering if he ever developed with ASP.NET at all if he didn't know that.

        2. StrangerHereMyself Silver badge

          If you want something simpler, than Razor Pages is EXACTLY what you're looking for but with a PROPER programming language, not some toy language.Razor Pages is the modern equivalent of Classic ASP.

          I personally advise against it. Unless you've doing something trivial like a web form that mails the content ASP.NET MVC or Blazor are much better choices.

          Any simple web app has the tendency to grow and grow. Might as well do it right from the start. It'll save you time in the long run.

        3. dhkirschman

          I can see both sides of the coin here. I liked classic ASP because I could edit a file in production with Notepad and tell the user... "I'm not seeing that... press F5 and try again." :)

          With that said, I love development goodies like intelli-sense, strong typing, compilation, and even WYSIWYG designers and the like.

          I will add that modern JS development and tooling it a lot better than it used to be... even just 3 years ago.

      3. itzumee

        I must’ve been the only person who wrote ASP server-side code in JavaScript (or JScript as per Microsoft) rather than VBScript (ugh), I never got why folk seemed to think that ASP was VBScript

  2. Wibble

    Not web forms

    It is also notable that the HTML delivered to the browser is little more than a div element to contain the application. At runtime the JavaScript populates this with the controls that form the user interface.

    That is not HTML and nothing like Web Forms and drives a horse and cart through accessibility, performance and reliability.

    What is wrong with nice simple HTML with a little bit of CSS and JavaScript for client-side validation plus some interaction? There's a reason Silverlight failed.

    1. Alan Bourke

      Re: Not web forms

      "with a little bit of CSS and JavaScript"

      There's no such thing. There's a morass of me-too frameworks in a shit scripting language.

  3. MatthewSt

    Download Size

    I like the emphasis people place on the download size... considering that the article page downloaded 4.7mb of resources!

  4. Geoffrey W

    FTA: 'is running .NET in the browser a good idea?'

    I know that's a semi humorous trope which triggers the anti MS crowd, but it's a bit misleading and unfair. I don't think .NET ever gets anywhere near the browser. A dll compiled in .NET is downloaded, for client side apps, but the API it exposes is WebAssembly, which is open standard, and works in all major browsers on all major OSs. .NET is nowhere in sight.

    1. MatthewSt

      Depends what you mean by ".NET". Technically it's entirely the opposite of what you said, because Blazor is a completely independent implementation of the .NET runtime and base libraries. So it's .NET (in terms of the standard / platform) but If your definition of .NET is "the stuff that ships with Windows" then you're correct as it's entirely different.

      1. Geoffrey W

        Blazor isn't an independent implementation of .NET; it uses .NETCore, the cross platform version of .NET, soon to be replaced by .NET5, as per the article. In client side web apps .Net Core does not even need to be installed on the server hosting the app. .NET core is installed on the dev machine and used to to compile it, so in that respect it is just like any other natively compiled program for any platform. The platform for client side blazor is WebAssembly which exists in the client browser. It has nothing to do with .NET at this point and is equivalent to any other WebAssembly app compiled in your preferred language of choice. I don't really understand the distinction you're making. Which may entirely be my fault.

        1. MatthewSt

          I suppose "independent" was used in the wrong context there, which may have confused things further. ".NET" at the moment covers a large number of things:

          * "Full" .NET Framework that ships with Windows

          * NETCore (soon to just be .NET 5)

          * Mono / Xamarin (Blazor used to be based on this version, it may not be anymore)

          What I was trying to say is that if you consider .NET to be the runtime components, then .NET is indeed being sent to the browser. In the same way that in the example you've given you ship .NET with your app to the server. Just because it's not installed separately doesn't mean that it's not there, it's just bundled in alongside the app.

          As much as NETCore runs on both Windows and Linux, it's different files (the framework pieces) that you deploy alongside your app. In this regard, WebAssembly is just another target that the framework runs on top of.

          Hope that makes sense. It's tricky to explain without pictures, and I couldn't find an existing article that links it all together.

          1. MatthewSt

            It doesn't really mention Blazor, but this article has some details into the different layers at the "framework" level - https://fearofoblivion.com/understanding-cross-platform-NET-and-why-NET-5-is-important

  5. Paradroid

    Is anyone really going to use this?

    For a public web site with accessibility and search engine considerations this is not the right technology. For apps there's big, established players like React, Angular and Vue.

    I understand the point that Blazor means C# developers can build web sites without any JavaScript knowledge, but how often is that the right option compared to skilling your devs up in JS, or hiring some front end devs on a permanent or temporary basis. Occasionally maybe, but not often

    1. SoftWiz

      Re: Is anyone really going to use this?

      The mentioned big players were, in a not so distant past, small players as well, you know.

      And they all share a similar approach to building web content, which is by leveraging html, js and css. Most of these 'combinations' are used in the real world by one of a dozen existing frameworks, like the ones you mentioned, which are the most popular ones.

      WebAssembly on the other hand is a totally new approach in providing content for web browsers and offers additional possibilities, like an entire 'native' DOOM game running in wasm, in the browser, and this is at near-native speed, not like the JS-based rewrite that exists.

      Microsoft is not at all the only one providing wasm-support for their developers (in the form of Blazor).

      I know the Java-world already has various projects in different stages of completion to offer exactly the same to their community, and I'm sure that Rust and other environments have too.

      And the reason they do this is that now, for most business applications, most businesses have the option to hire 'full-stack' engineers, which need to know C#/Java/... and need to know one of the popular and ever-changing web (javascript) frameworks. The other option they have is to hire additional front-end developers which should only be bothered by these front-end technologies.

      In practice this means a not always flawless or easy integration of front- and back-ends, and mostly separate codebases with developers not really knowing the others' codebase (or used technology).

      When having developers that can do both back- and front-end in the same language and technology stack, and they can easily share their datatypes, things can be easier and faster, and be inside one and the same codebase.

      Currently, existing proven JS-libraries can be used from wasm/blazor, but the idea is that most of most popular JS-libraries will be offered as a blazor/wasm library so there really is little reason to needing to dive in JS. An effort has already started to transfer such libraries and components to Blazor and if I'm not mistaken, quite a lot already are available.

      Sure, there still will be web-applications that might be better developed with existing web frameworks, but majority of business-oriented apps will benefit from wasm.

      On top of all this, when using Blazor, eventually in conjunction with the UNO-platform or Xamarin, you can provide web applications, (native) mobile apps, electron apps and winforms/desktop apps all from one and the same code.

      And since most business are really going for a multi-level presence, I'm pretty sure this will surely be a hit.

      A comparison with Silverlight really is not relevant here, since it was a MS-only technology, mainly supported by IE. Wasm is a technology already supported by ALL popular web browsers and is an open standard.

      1. Robert Grant

        Re: Is anyone really going to use this?

        Sure, but something like Kotlin Multiplatform seems like a potential even bigger win, covering mobile, backend and web. Interesting times ahead!

        1. SoftWiz

          Re: Is anyone really going to use this?

          Yes Kotlin is a great and fresh language/platform too with great possibilities, even though I don't think they already quite offer wasm support, but I'm sure if that isn't yet the case, it will be soon.

          I think that what one can do with Kotlin and the .NET ecosystem will be virtually identical, although the implementation might differ here or there.

          But as you said: interesting and exciting times ahead!

          For sure, for people like myself who have quite some experience in mainly the back-end with an interest in front-end, but not wanting to invest time and effort time to get to grips with the newest front-end fad every couple of years, this is interesting news.

          Finally I can focus on the one technology I'm proficient with and do front-end (hopefully) without needing to reorient myself every x years.

  6. Anonymous Coward
    Anonymous Coward

    ActiveX 2.0

    Yay! Cried no-one.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon