为什么逗号出现在文件路径中? [英] Why a comma appears in the file path?

查看:264
本文介绍了为什么逗号出现在文件路径中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么文件路径中出现逗号?



这是消息:

无法找到路径的一部分' '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

解决方案

开发服务器和iis不一样。设置您的项目以使用本地iis(假设您有一个)。并使用 MapPath [ ^ ]到IIP虚拟路径到文件系统的。

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

解决方案

Development server and iis are not the same. Set up your project to use local iis (supposing you have one). And Use MapPath[^] to IIP virtual paths to file system ones.


这篇关于为什么逗号出现在文件路径中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆