How to Clear ASP.NET Web Cache

In ASP.NET you can remove an item from the web cache by invoking Cache.Remove(string ID). But, what happens when, for some reason, you want to quickly clear the whole cache? There’s no Clear or RemoveAll method in System.Web.Caching.Cache object.


You can iterate over all the entries and remove them by their key (or ID), using the GetEnumerator method of the Cache class.

IDictionaryEnumerator enumerator = Cache.GetEnumerator();


Unable to Add Summary Links Web Part (Error 0x80070002)

Funny thing happened today when I tried to export / import a site from one site collection into another one. It asked me to close the Summary Links web part, which I did. I tried to add it manually (importing a .webpart file exported from the source site), and it gave me the following error:

Unable to add selected web part(s). Could not load XSL file. The system cannot find the file specified.(Exception from HRESULT: 0x80070002).


This error is usually raised when you try to add a publishing-related web part (such as Summary Links) into a non-publishing site. You have to either add it into a site built with a publishing template (Collaboration Portal or Publishing Portal), or to activate the publishing features manually:

  • Activate Office SharePoint Server Publishing Infrastructure feature in site collection features, in Site Collection Administration section of Site Settings page
  • Activate Office SharePoint Server Publishing feature in destination site features, located on Site Administration section of Site Settings page

How to Replace Notepad in Windows Vista

I’m much fond of the Flo’s excellent Notepad2 editor. Replacing the simple built-in Notepad is one of the first things that I customize on my developer box.

After the Vista Service Pack 1 is applied, my Notepad2 replacement is rolled back. I have to do it again, and I leave this simple walkthrough for anyone in the same situation:

  • Rename the downloaded Notepad2 from Notepad2.exe into Notepad.exe
  • Locate Notepad.exe files in C:Windows and C:WindowsSystem32 folders
  • Edit the permissions for those files:
    • Properties / Security / Advanced / Owner tab: change to Administrators group
    • Properties / Security tab: give Administrators group Full Control on the file
  • Copy and paste the renamed Notepad2 file in those folders, confirming the UAC message box
  • That’s it! No more ugly Notepad….


Import a Specific Active Directory Group User Profiles

Sometimes we want SharePoint to import only the user profiles of those user that belong to one specific Active Directory group. In this case we have to modify the import connection query expression in Shared Services Provider.

In this case we want all the users of the group Employees (in Groups OU) of the domain to be imported:


“I Need To…” Web Part and JavaScript error

If you try to customize the "I Need To…" web part, as outlined by Gary in his blog post, you might experience a JavaScript error, just like this one:

Line: 1
Char: 1
Error: Object expected
Code: 0

This error is launched by the TATWP_jumpMenu JavaScript function, because it attempts to execute a function defined in another .js file that hasn’t been loaded.


Add a hidden Content Editor Web Part with the following HTML source text:

<script language="javascript" src="/_layouts/portal.js?rev=INhSs9mWTnUTqdwwIXYMaQ%3D%3D"></script>

This will ensure that the referenced script file loads correctly.

IE8 Passes the Acid2 Test

I downloaded the Beta 1 of Internet Explorer 8 from and I was pleasantly surprised that it passes successfully the hard Acid2 test that tests for web standard compliance. It seems that IE8 has a brand new render engine, although the beta keeps an "Emulate IE7" button, just in case.

Acid2 test for FireFox 2


Acid2 test for IE8 Beta1