Dofactory.com
Dofactory.com
 Back to list
Views:   2.7K
Replies:  0
Archived

Returning a NULL object reference error when loading the web application

Hi,
 
I'm returning a null object reference when running the inital page.  The error occurs in the SavePageState method calling LoadProviders();


the _provider = _providers[section.DefaultProvider]; is returning a null value

I noticed that my section.providers returns a count of 0 from below.

The error occurs at _provider.SavePageState(name,viewstate); (actually error NullReferenceException was unhandled by user code.  I see a first and second in the viewstate object the first is Null.


Please note I'm not using the WCF since it was not necessary.

Regards,

var section = (ViewStateProviderServiceSection)
                            WebConfigurationManager.GetSection("myviewstateSection/viewstateService");                            

                        // Load all registered providers
                        _providers = new ViewStateProviderCollection();

                        ProvidersHelper.InstantiateProviders
                            (section.Providers, _providers,
                            typeof(ViewStateProviderBase));

                        // Set _provider to the default provider
                        _provider = _providers[section.DefaultProvider];

 
Joe Contreras, Jul 16, 2013
Hi guy! I got an error when I create a new project and using some class in Code folders. HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. This error showed when I used code below How to do to pass this error? Thank!
Dec 09, 2014
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.