protected void RenameFileButton_Click(object sender, EventArgs e) { RenameFilePanel.Visible = true; Page.Validate("FileNameGrp"); if (!Page.IsValid) { return; } try { if (DM.RenameFile(Path.Combine(FolderPath, RenameFileSourceHdn.Value.Trim()), RenameFileNameTextBox.Text.Trim())) { Response.Redirect(string.Format("managedrive.aspx?folderpath={0}", FolderPath)); } } catch (DirectoryNotFoundException) { message3.Text = "Invalid File Selected."; message3.Indicate = AlertType.Error; message3.Visible = true; } catch (ArgumentException) { message3.Text = "Please avoid \\ / : ? * \" > < |"; message3.Indicate = AlertType.Error; message3.Visible = true; } catch (IOException) { message3.Text = "File exists or You do not have permission to perform this action."; message3.Indicate = AlertType.Error; message3.Visible = true; } catch (UnauthorizedAccessException) { message3.Text = "You do not have permission to perform this action. Please avoid \\ / : ? * \" > < | in file name."; message3.Indicate = AlertType.Error; message3.Visible = true; } }