Farewell, ASP.NET Web Forms, We Hardly Knew Ye

ASP.NET Web Forms, the venerable web framework that Microsoft shipped with the .NET framework almost 15 years ago and we all hate love, is going away. Yes, it’s official: ASP.NET 5 will not include Web Forms, only MVC 6. ASP.NET 4.6, however, will still include Web Forms, including some updates, but the future appears to be all MVC (and OWIN, for that matter). Having spend a lot of my professional life working with Web Forms, I feel kind of sad. Yes, I do acknowledge event-hell, viewstate-hell, etc, but I find it easy to get around this once you know a thing or two. But what I really like about Web Forms is the reuse capacity that server-side controls offer: just add a reference to an assembly containing controls, register them in Web.config or in the page, and you’re done. A control encapsulates both client and server-side logic, so it is the perfect reusability mechanism for the web, in my opinion, and I wrote tens of posts on it. MVC now offers somewhat similar mechanisms, in the form of view components and tag helpers, but before that, there was really no reuse mechanism – partial views cannot be referenced from an assembly and helper methods cannot be extended. Don’t get me wrong: I like MVC, but I think that Web Forms was complementary. Taking in consideration the extensibility mechanisms offered by MVC, I can imagine that someone will even implement Web Forms on top of it! Winking smile

Apart from Web Forms, ASP.NET 5 seems promising! I published recently an article on it for the portuguese magazine Programar, which you can find here. I may translate it to english and add a thing or two in the next couple of days, so stay tuned!

SharePoint Pitfalls: Save Publishing Site as Template Option Missing

If you want to save a publishing site as a template, so that it can be used to create other sites, you may find it surprising that the option is missing from the site settings page:

image

I don’t know exactly why, but publishing sites hide this option, however, it’s not difficult to get around it: just navigate to /_layouts/15/savetmpl.aspx. But, wait, what if you get this?

image

Easy, easy. Open your site in SharePoint Designer, click Site Options:

image

and change the value of property SaveSiteAsTemplateEnabled from false to true:

image

And now you will be able to access savetmpl.aspx and save your site.

SharePoint Pitfalls: Creating a Visual Studio Project Without SharePoint Locally Installed

This is the first on a (huge) collection of posts on SharePoint pitfalls. Hope you enjoy, and, please, do send me your feedback!

If you do not have SharePoint locally installed, Visual Studio will not let you create a SharePoint project:

sp-not-installed

Fortunately, it is easy to go around this in two simple steps:

  1. RegistryIn the Registry, add the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\SharePoint

    In it, add two string values: Location=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ and SharePoint=Installed

  2. Global Assembly CacheCopy the following assemblies from a machine where SharePoint is installed (C:\Windows\Microsoft.NET\Assembly\GAC_32) into your development machine and add them to the GAC (gacutil):
    • Microsoft.SharePoint.dll
    • Microsoft.SharePoint.Client.dll
    • Microsoft.SharePoint.Client.Publishing.dll
    • Microsoft.SharePoint.Client.Runtime.dll
    • Microsoft.SharePoint.Client.ServerRuntime.dll
    • Microsoft.SharePoint.Library.dll
    • Microsoft.SharePoint.Linq.dll
    • Microsoft.SharePoint.Portal.dll
    • Microsoft.SharePoint.Publishing.dll

    Of course, you may need others as well.

Enjoy!