public static void ClearRazorCache()
{
// For safety
if (IsRunning)
throw new Exception("The Razor Cache cannot be cleared while the HttpServer is running.");
try
{
// Get our [User]/AppData/Local/Temp folder Location
string folderPath = Path.GetTempPath();
// Clear dynamic cache files
foreach (string dir in Directory.GetDirectories(folderPath, "RazorEngine_*"))
Directory.Delete(dir, true);
}
catch (Exception e)
{
Program.ErrorLog.Write("NOTICE: [HttpServer.ClearRazorCache] " + e.Message);
}
}
}