+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / NullReferenceException in Sitefinity Admin - resolved!

NullReferenceException in Sitefinity Admin - resolved!

4 posts, 0 answered
  1. Steve
    Steve avatar
    2 posts
    Registered:
    05 Aug 2008
    25 Sep 2008
    Link to this post
    Throwing this out there because it had been driving us nuts for a while, and we finally tracked it down ...

    We had been getting NullReferenceExceptions ("Object not set to an instance of an object") in various parts of Sitefinity Admin.

    The setup is a little odd, in that we have it running in a Virtual Directory under a much larger application, and we figured that was causing the issues we were seeing, but couldn't figure out how.

    We finally tracked it down. Turned out that ViewState was disabled in the parent application's web.config, and several screens in Sitefinity Admin rely on ViewState being enabled.

    The cleanest fix (if your application needs ViewState disabled) is to go to the Sitefinity subfolder under your application and edit the web.config to only enable ViewState in the Sitefinity Admin screens (note the attributes on the <pages> tag ...

    <configuration> 
        <appSettings/> 
        <connectionStrings/> 
        <system.web> 
                <pages enableViewState="true" enableViewStateMac="true" viewStateEncryptionMode="Auto"
                    <controls> 
                        <add tagPrefix="sf" namespace="Telerik.Cms.Web.UI" assembly="Telerik.Cms.Web.UI"/> 
                        <add tagPrefix="sf" namespace="Telerik.Cms.Web.UI" assembly="Telerik.Cms"/> 
                        <add tagPrefix="sfSec" namespace="Telerik.Security.WebControls" assembly="Telerik.Security"/> 
                    </controls> 
                </pages> 
            </system.web> 
    </configuration> 
     
     

  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    26 Sep 2008
    Link to this post
    Hello Steve,

    Yes, Sitefinity does take advantage of ViewState quite a lot. We are sorry that we have not document this requirement more clearer. We will make sure to make this clearer.

    Thank you for bringing up this issue to our attention. Let us know if there is anything else we can do for you.

    Regards,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Steve
    Steve avatar
    2 posts
    Registered:
    05 Aug 2008
    26 Sep 2008
    Link to this post
    Ivan,

    You could also query to find out if ViewState is enabled, and throw an exception if it is not. The problem with the NullReferenceException is there is no way to know that ViewState is the issue - so the system appears buggy and unstable when it is really just configured wrong.

    If you enable viewstate just in the Sitefinity as I suggested, that would be a clean solution, and you would never even run into the problem, so you would not build the perception of bugginess.
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    26 Sep 2008
    Link to this post
    Hello Steve,

    thanks for the suggestion, we will surely consider it. We'll need some time to make the final decision on how are we going to handle this problem, but it will be handled.

    Thank you.

    Greetings,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered