UnauthorizedException:拒绝访问路径 这个报错是在我使用File.CreateText(_path/test.txt)的时候抛出的错误,问题大概是 我想要在一个不存在的路径_path下面创建文本。 这里我们需要判断下路径是否存在。 if(not Directory.Exist(_path)) Directory.CreateDirectory(_path); StreamWriter sw = File.CreateText(_path + "/test.txt");