Jackson is right, this is a direct File Path Manipulation vulnerability that can be fixed by indirect selection. List all files from your famous directory. Use a value coming from your own directory list, not a custom value.
String rName = Request.QueryString["reportName"];
String knownPath = "C:\\hari";
DirectoryInfo di = new DirectoryInfo(knownPath);
FileInfo[] files = di.GetFiles(rName);
if (files.length > 0)
{
files[0].Delete();
}
source
share