Why is access to the path denied?

前端 未结 29 1081
刺人心
刺人心 2020-11-22 15:25

I am having a problem where I am trying to delete my file but I get an exception.

if (result == \"Success\")
{
     if (FileUpload.HasFile)
     {
         t         


        
29条回答
  •  北海茫月
    2020-11-22 15:56

    I was facing this error because

    Sometimes when I Combine the path with File Name and FileName = ""

    It become Path Directory not a file which is a problem as mentioned above

    so you must check for FileName like this

    if(itemUri!="")
            File.Delete(Path.Combine(RemoteDirectoryPath, itemUri));
    

提交回复
热议问题