在我的asp.net应用程序中,我正在编写一个代码后面的文件。然后我想把这个文件用到下面的Handler中,但是我得到一个错误'Path in Illegal characters'。我不明白为什么?请帮助。WebClient中的文件路径
文件在下面的值为“306963020170816111848_Generic_P.pdf”,并在文件中正确的路径肯定存在
WebClient client = new WebClient();
client.DownloadString(@"Handlers/MyPrintPdf.ashx?PdfFile=" + Server.MapPath("~/Templates/MyFiles/" + files)); // error here
改为使用
HttpUtility.UrlEncode(@"Handlers/MyPrintPdf.ashx?PdfFile=" + Server.MapPath("~/Templates/MyFiles/" + files));
文件字符串的值是多少? –
其306963020170816111848_Generic_P.pdf – user2837961