Minimum Viable Product - Part 10 - The End
Let's put a bow on this series
In this series we looked at how to get a blog up and running with some minimal features. I'd like to conclude it with a few things we haven't yet mentioned and finally send you on your way.
Umbraco handles routing so you really don't have to. However when a 404 or 500 is detected you'll want to inform the user of the situation and avoid displaying all of your stack trace information for prying eyes. I don't necessarily know the 'right' way to do it, but the way I do it is consistent from site to site and even works on multisite installations.
When either a 404 or 500 occurs, I just send the user to the predetermined URL's '/page-not-found' and '/server-error'. Behind the scenes I just create a document type named ErrorPage and give them a common template. When the page displays I have to manually set my HttpStatusCode to 404 and 500 respectively. On multisite installations, each site will have their own error pages and it all works provided the names remain the same.
To pull this off, all I have to do is edit a few lines in my web.config file:
<customErrors mode="On" defaultRedirect="/server-error/">
<error statusCode="404" redirect="/page-not-found/" />
<error statusCode="500" redirect="/server-error/" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/page-not-found/" responseMode="ExecuteURL" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" prefixLanguageFilePath="" path="/server-error/" responseMode="ExecuteURL" />
The reason for the duplication in code has to do with different versions of IIS (and probably other stuff). If you'd like to send the users to different url's, just put in different paths. The only drawback is the fact you have to manually set the response code to 400/500 otherwise it'll return 200 OK. If you do some googling, there's various ways to do the error pages in Umbraco. As you'll notice, I don't do anything with the umbracoSettings.config file which has some settings for 404's.
Another approach is to use the content finder functionality and replace the default 404 handler.
Max Upload Size/Execution Time
At some point you may find that uploading a large file into the media section fails. It's probably due to the default max file size and/or max execution time. Again it's an easy fix and is done via the web.config again:
<httpRuntime requestValidationMode="2.0" enableVersionHeader="false" targetFramework="4.5" maxRequestLength="26214400" executionTimeout="3600" />
The two attributes to pay mind to are maxRequestLength="in bytes" executionTimeout="in seconds".
To infinity and beyond!
So now that you've gotten most of the basics of Umbraco, I'd like to wet your appetite for whats possible with Umbraco. Umbraco is highly extensible and has many community built add-ons called packages. You can download them from the community site and install locally. Many of the packages are co-hosted on Nuget. If possible I highly recommend using the Nuget version but only if you have set up your site in Visual Studio and are using Nuget for the core.
The official documentation keeps getting better by the day and there is a free Slack community that is open for everyone. The forums are still the best place to get specific help and I've even put together a free e-book with the help of other contributors.
Keep in mind that there are many ways to do things that may be different from how I've done them. Since Umbraco is .NET/MVC, your MVC way of doing something may well just work great with Umbraco. As long as it works and is manageable, it's right. Take what I've written in this series with a grain of salt and a pound of inspiration. Good luck and hope to hear from you if you need some help!