This project is read-only.

The "WhatsNewWebPart" Web Part appears to be causing a problem. Object reference not set to an instance of an object.


First off, thank you for a great web part.
Second, I have an interesting issue...
Background Info:
I have a MOSS 2007 single server web farm with a SQL Server 2005 backend server.
I have created a Web Application and Site Collection and 2 Sub-Sites using a Host Header with port 80 (http://test) using the Default zone to be used inside the AD Domain using Windows Auth.
I have extended the Web Application using a Host Header with port 80 ( using the Extranet zone to be used for external partners using FBA (SQL provder)
I also have extended the Web Application using a Host Header with port 80 ( using the Internet zone to be used for public viewing using FBA (different SQL provder) but allowing for Anonymous
I have configured SharePoint AAM and have tested extensively. All sites are fully functional.
I then install the WhatsNew Web Part using the setup.exe included in the file.
When I add the web part to one of the sub-sites, it works perfectly in the Default zone (http://test).
I then switch to the the Extranet zone ( still works.
But then switch to the the Internet zone ( and I receive the following error:
"The "WhatsNewWebPart" Web Part appears to be causing a problem. Object reference not set to an instance of an object.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator."
Any idea why this would happen in the Internet zone (public) only?
Any insight would be greatly appreciated


RyanLMiller wrote Jan 26, 2009 at 5:25 PM

I do have the what's new web part working with FBA, but it is failing for anonymous access. I haven't stepped through the code yet, but I think this is probably a null reference in the GetCacheKey() method where it tries to use SPContext.Current.Web.CurrentUser.Sid

_tomdaly_ wrote Mar 10, 2009 at 1:14 AM

I had the same issue and decided to look into more. I have a regular SP site (no fba) and anonymous access enabled with the Whats New on the home page. RyanLMiller is correct, SPContext.Current.Web.CurrentUser is null when anonymous access is enabled. Not sure if this is the best method but from what I understood is that a cache of the page is created and part of the key uses the CurrentUser.Sid so each user has their own cachekey. So I changed the GetCacheKey function to this:
   private string GetCacheKey()
        if (SPContext.Current.Web.CurrentUser != null)
            return string.Format("{0}.{1}.{2}", CACHEKEYPREFIX, SPContext.Current.Web.CurrentUser.Sid, this.ID);
            return string.Format("{0}.{1}.{2}", CACHEKEYPREFIX, "anonymous" , this.ID);
So all anonymous users would use this same cachekey. Which I'm pretty sure that means that all anonymous users 'Whats New' web part would update the grid at the same time. Part of the web part properties is a cache interval. So if you had 50 anons they would all see the updates to the grid once that cache interval is passed (all anons simultanously). For individual users they see the grid the first time (then its cached) and then they would load up a new grid after cache interval. This would keep continuing for every cache interval. Each individual has their own cachekey while the anonymous share the one.

This is currently working for me in my environment which i will be testing out with users tomorrow.
tom daly

wrote Mar 10, 2009 at 1:15 AM

Averagegeek wrote Jul 14, 2011 at 9:15 PM

I'm having the same problem - this web part doesn't work for my anonymous users. I'm fairly new to the world of Sharepoint, but have full admin access. How would I go about modifying the GetCacheKey function as documented here?

wrote Feb 14, 2013 at 9:22 PM