首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

读取文档有关问题 急

2012-04-11 
读取文档问题 急!!!C# codepublic ActionResult ProduceDataReceive(string path) {string[] files Dire

读取文档问题 急!!!

C# code
public ActionResult ProduceDataReceive(string path) {      string[] files = Directory.GetFiles(Path, "*.txt", SearchOption.TopDirectoryOnly);      foreach (string file in files)      {          string[] lines = System.IO.File.ReadAllLines(file, Encoding.GetEncoding("UTF-8"));      } }

为什么用上面一段代码读取的是服务器上对应path里面的文档,而不是客户端机器上,如果我要读本机上的该怎么写

[解决办法]
你的Path是神马啊,你本机不就是 "c:\\1.txt"之类的吗
[解决办法]
你访问的是服务器程序,当然读的是人家的资源,想读本地的要把路径写清楚,看看你的path是什么,不能写相对路径
[解决办法]
读取目标在于你的path怎么写,path是客户机读取的是客户机,path是服务器就读取的是服务器上的信息
[解决办法]
读客户机,你用js实现吧.

热点排行