Sitecore: An instance of Sitecore.Data.Items.Item was null. Additional information: Failed to find the root item "/".

This one was my vault. I tried to get rid for the viewstate to gain speed. So I disabled Viewstate for the whole website and sitecore backend via web.config.

The better solution is to do it in Codebehinf or in the ASCX files.

In ASCX files:


<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="true" CodeBehind="WebService.ascx.cs"  Inherits="ICR..WebServices.WebService" %>


In code behind :

Do it like this:

protected void Page_Init(object sender, EventArgs e)

        {

            this.EnableViewState = false;       

        }




Server Error in '/' Application.

An instance of Sitecore.Data.Items.Item was null. Additional information: Failed to find the root item "/".

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: An instance of Sitecore.Data.Items.Item was null. Additional information: Failed to find the root item "/".

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: An instance of Sitecore.Data.Items.Item was null. Additional information: Failed to find the root item "/".]
   Sitecore.Web.UI.HtmlControls.DataContext.GetState(Item& root, Item& folder, Item[]& selected) +1404
   Sitecore.Web.UI.HtmlControls.DataContext.GetRoot() +39
   Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnLoad(EventArgs e) +1553

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +155
   Sitecore.Reflection.ReflectionUtil.CallMethod(Type type, Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Boolean includeStatic, Object[] parameters) +141
   Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +395
   Sitecore.Shell.Web.UI.SecurePage.OnLoad(EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249

Comments