Imports System.IOPartial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Function ClearCache() If ClearCache() = True Then Response.Write("Cache Cleared") Else Response.Write("Cache not cleared") End If End Sub Sub EmptyCacheFolder(ByVal folder As DirectoryInfo) For Each file As FileInfo In folder.GetFiles() file.Delete() Next 'For Each subfolder As DirectoryInfo In folder.GetDirectories() ' EmptyCacheFolder(subfolder) 'Next End Sub 'Function which is used for clearing the cache Public Function ClearCache() As Boolean Dim Empty As Boolean Try EmptyCacheFolder(New DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache))) Empty = True Catch Empty = False End Try Return Empty End FunctionEnd Class