// This function is used to delete the temporary directories that are created on the server when files are downloaded. internal void DeleteTempDirectory(string GUID) { try { // Validate the GUID. System.Guid guid = new System.Guid(GUID); // Get the local path for the AMDownload directory. string filePath = System.Web.HttpContext.Current.Request.MapPath(Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY); // Add the GUID to complete the temporary filepath (i.e. 'C:\Inetpub\wwwroot\AMDownload\6c5fb16e-9332-46ce-9eab-94ab6b4f5cdb'). filePath += guid.ToString(); try { Directory.Delete(filePath, true); } catch (Exception ex) { SharedSupport.LogMessage(SharedSupport.GetLocalizedString("Assignment_DeleteStarterProjectFailed") + filePath + " " + ex.Message); } } catch (Exception GUIDException) { // Invalid GUID returned, abort delete action to prevent the deleting or files outside of AMDownload directory. SharedSupport.LogMessage(SharedSupport.GetLocalizedString("Assignment_DeleteStarterProjectFailed") + GUID + " " + GUIDException.Message); } }