1
我想创建一个自定义Windows快捷方式并将其下载到asp.mvc中。 具体而言,我希望能够以动态服务器作为参数下载远程桌面快捷方式。创建Windows快捷方式并在ASP.NET中下载它
我在互联网上穿越了这个例子,但显然不适用于web应用程序。
public ActionResult Download()
{
WshShell wsh = new WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut("/shorcut.lnk") as IWshRuntimeLibrary.IWshShortcut;
shortcut.Arguments = "";
shortcut.TargetPath = "c:\\app\\myftp.exe";
// not sure about what this is fro
shortcut.WindowStyle = 1;
shortcut.Description = "my shortcut description";
shortcut.WorkingDirectory = "c:\\app";
//shortcut.IconLocation = "specify icon location";
shortcut.Save();
return File("/shorcut.lnk", "application/octet-stream", "shorcut.lnk");
}
我得到了一个普通的访问被拒绝。还有另一种方法可以做到吗?
哪条线给你的拒绝访问错误? –