本文介绍了为什么逗号出现在文件路径中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么文件路径中出现逗号?
这是消息:
无法找到路径的一部分' 'C:\Program Files(x86)\ Common Files \ Mysoftoft Shared\DevServer\10.0 \,\ ninranet \IPPDRIVE \\\\ .RecepcionMateriaPrima.xls''。
$ b这是代码:
private void DownteFileFolder(string FolderNames) b
$ b FileInfo file = new FileInfo(FolderNames);
// if(file.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader(content-disposition,attachment; filename =+ FolderNames);
Response.AddHeader(Content-Type,application / Excel);
Response.ContentType =application / vnd.xls;
Response.AddHeader(Content-Length,file.ToString());
//Response.AddHeader(\"Content-Length,file.Length.ToString());
Response.WriteFile(file.FullName);
//Response.WriteFile(file.FullName);
Response.End();
您应该看到以下路径:
C:\inetpub \wwwroot \intranet \IPPDRIVE \\\\ RecepcionMateriaPrima.xls
解决方案
Why a comma appears in the file path?
this is the message:
Could not find a part of the path ''C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\,\intranet\IPPDRIVE\a\RecepcionMateriaPrima.xls''.
this is the code:
private void DownteFileFolder(string FolderNames) { FileInfo file = new FileInfo(FolderNames); //if (file.Exists) { Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=" + FolderNames); Response.AddHeader("Content-Type", "application/Excel"); Response.ContentType = "application/vnd.xls"; Response.AddHeader("Content-Length", file.ToString()); //Response.AddHeader("Content-Length", file.Length.ToString()); Response.WriteFile(file.FullName); //Response.WriteFile(file.FullName); Response.End();
you should see the following path:
C:\inetpub\wwwroot\intranet\IPPDRIVE\a\RecepcionMateriaPrima.xls
解决方案
这篇关于为什么逗号出现在文件路径中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!