【发布时间】:2014-11-06 07:21:19
【问题描述】:
我的项目中有一个.aspx 页面,里面有一个<a> 链接供下载.txt 文件。
我使用Shell32.ShellClass 和Shell32.Folder2 显示浏览文件夹 询问用户您要将文件保存在哪里而不是下载到默认的Downloads 文件夹。
下面是我的C# 显示对话框的代码。
Shell32.ShellClass shell = new Shell32.ShellClass();
Shell32.Folder2 flder = (Shell32.Folder2)shell.BrowseForFolder(0, "Select destination folder", 0,"Desktop");
if (flder == null)
{
dlgResult = DialogResult.Cancel;
}
else
{
strPath = flder.Self.Path;
dlgResult = DialogResult.OK;
File.WriteAllText(strPath + "\\NewFile.txt", "file content abc tex...");
}
问题:以上代码在本地运行良好但是当我在 IIS 上托管网站时它不工作并且不显示对话框。
在 IIS 中是否有任何特定的设置或配置?或者为什么它在 IIS 中托管时不起作用?
请给我建议。
谢谢。
【问题讨论】: