I want to delete all files from the folder if the specified directory exist. I tried with below code, but it is giving me error as
Additional information: Could not find a part of the path 'D:\Username\VSATFINAL_353\VSATTSSRSurvey\NESSPATH\VSAT\SignedDoc\I-KA-CTPR-ENB-9016C3.pdf'.
I tried with below code but it is not working.
protected void delete_ServerClick(object sender, EventArgs e)
{
string strServerFolder = "";
string strSapID = EncryptDecrypt.Decrypt(HttpUtility.UrlDecode(Request.QueryString["SapId"]));
string strCandidateId = EncryptDecrypt.Decrypt(HttpUtility.UrlDecode(Request.QueryString["CandidateId"]));
strServerFolder = Server.MapPath(ConfigurationManager.AppSettings["VSATSharedPath"].ToString() + strSAPCandidate + @"\" + "SignedDoc" + @"\");
string strFilePath = Server.MapPath(ConfigurationManager.AppSettings["VSATSharedPath"].ToString() + strSAPCandidate + @"\" + "SignedDoc" + @"\" + strSapID + "_" + strCandidateId + ".pdf" + @"\");
if (!Directory.Exists(strServerFolder))
{
Directory.Delete(strFilePath);
}
}