Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

Umbraco Exception Details - System.InvalidCastException Specified cast is not valid

Whilst trying to use Umazel Starter Kit on the latest version of Umbraco 7.6.3 I was getting the following Asp.Net Error:-

Exception Details: System.InvalidCastException: Specified cast is not valid.
switch ((int)currSection.TitleSize)



Open umbracoSettings.config file usual in the Config directory of Umbraco.



and change to 


Umbraco 7.6 Compiler error Type exists in both Temporary Asp.Net dll file

Whilst trying to use Umazel Starter Kit on the latest version of Umbraco 7.6.3 I was getting the following Asp.Net Error:-

Compiler Error Message: CS0433: The type 'Umbraco.Web.PublishedContentModels.Pagehome' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3c224001\fb5ad5e1\App_Web_all.generated.cs.8f9494c4.zr84uuak.dll' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3c224001\fb5ad5e1\assembly\dl3\4e0eb2b9\6e2d66f5_3ae0d201\Umbraco.Web.PublishedContentModels.DLL'


This is odd as the start kit works fine in version 7.5 of Umbraco.


Open with Web.Config for Umbraco in default Directory and find (usual under appSettings):-

<add key="Umbraco.ModelsBuilder.Enable" value="PureLive" />

change the value from ="PureLive" to ="Dll" e.g.

<add key="Umbraco.ModelsBuilder.Enable" value="Dll" />

Umbraco Redirect 404 errors to default home page

I needed to redirect 404 not found errors to the default home page in Umbraco.  Usually in Asp.Net you can just set the web.config and set an error statuscode to do something.  However in Umbraco it uses its own internal 404 page which has a neater way of redirecting to a page you specify.

First login to your Umbraco site.  Go the page you want the 404 to be redirected to, here I am using my Home Page (default page).

Notice the URL and the last 4 digits (1012).  Remember this bit.

Open the UmbracoSettings.config - this is usually in the Umbraco Config directory.  Find the <errors> section and specifically <error404> e.g.

Then enter the URL ID as seen above and now any 404's will be redirected to your home page (but the url will still show as the incorrect path).