如何从已发布的Web应用程序中打开文件资源管理器?

如何从已发布的Web应用程序中打开文件资源管理器?

问题描述:

下面是我正在使用的代码,它在本地工作,但Web应用程序发布到服务器它不起作用。我试过冒充,但仍然没有。它没有给出任何错误信息,它什么都不做。任何帮助?

Below is the code i am using, it works locally but the web application published to a server it does not work. I have tried impersonation and still nothing. It gives no error message it just does nothing. Any help?

Dim openthis As String = System.Environment.CurrentDirectory
                   Process.Start("Explorer.exe", openthis)

该代码在服务器上运行 / b>。



如果有效,它将打开服务器上的Windows资源管理器 ,没人会看到它。



在Visual Studio中运行站点时,它可能出现,但这只是因为服务器和客户端在特定情况下是同一台计算机。



无法从服务器代码启动客户端上的Windows资源管理器。即使有,客户端也无法访问您服务器上的文件系统。
That code is running on the server.

If it works, it will open Windows Explorer on the server, where nobody will ever see it.

It might appear to work when you run your site in Visual Studio, but that's only because the server and client are the same computer in that specific case.

There is no way to launch Windows Explorer on the client from server code. And even if there was, the client would not have access to the file system on your server.


Hello



使用ClickOnce 。



https://msdn.microsoft .com / zh-CN / library / t71a733d.aspx [ ^ ]



您需要创建一个控制台,winform或wpf项目并使用clickonce发布它。



https://msdn.microsoft.com/en-us/ library / 31kztyey.aspx [ ^ ]



一旦你有一个你想要的工作程序(即打开Windows资源管理器),你可以从你的asp.net站点重定向到clickonce网址:



Hello

Use ClickOnce.

https://msdn.microsoft.com/en-us/library/t71a733d.aspx[^]

You will need to create a console, winform or wpf project and publish it using clickonce.

https://msdn.microsoft.com/en-us/library/31kztyey.aspx[^]

Once you have a working program that does what you want (ie opening windows explorer) you can redirect from your asp.net site to the clickonce url:

HttpContext.Current.Response.ContentType = "application/x-ms-application"
HttpContext.Current.Response.Redirect(url, False)
HttpContext.Current.ApplicationInstance.CompleteRequest()





这将下载你的程序,在查询字符串中传递你需要的参数,就是这样。



https://msdn.microsoft.com/en-us/library/ms172242.aspx [ ^ ]





Valery。



This will download your program, pass what ever parameters you need in the query string and that's it.

https://msdn.microsoft.com/en-us/library/ms172242.aspx[^]


Valery.