【发布时间】:2017-04-09 18:37:44
【问题描述】:
我创建了一个 Web 应用程序来打开本地目录中的文件(无论是记事本、excel、PDF 等)。文件在 IIS Express 中运行时打开,但在 IIS 本地 Web 服务器中,它没有打开文件。
我在 Visual Studio 的项目中有文件。
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@"D:// Path ");
IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.*");
var newestFile =
(from file in fileList
//where file.Contains(para)
orderby file.CreationTime
where file.FullName.Contains(para)
select new { file.FullName, file.CreationTime })
.Last();
Process.Start(newestFile.FullName);
return "";
【问题讨论】:
-
Process.Start 在服务器上运行,而不是在客户端上运行。您是否希望用户看到这些文件打开?
-
Yes.. 用户需要在 process.Start() 中打开指定文件
-
那不行,他们必须下载文件。
-
好的,谢谢.. 我能有这个想法吗?我正在使用 MVC 应用程序
-
谷歌文件流结果
标签: c# asp.net-mvc iis iis-express