如何从客户端打开指定的驱动器 [英] How to open a specified drive from client side

查看:87
本文介绍了如何从客户端打开指定的驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我的网站上有功能

如果我单击可以在资源管理器中打开的链接,则动态显示指定链接的驱动器
从客户端

在process.start中仅在本地工作,但是当我在iis中发布时,它不在客户端工作,因此我想通过 shell命令或命令提示符打开客户端

hi all

i have a functionality in my website

dynamically show a link specified drive if i click that link it can open in explorer
from client side

in process.start is working only local but when i publish in iis it''s not working client side so i want to open client side through shell command or command prompt

public enum ShowCommands : int
   {
       SW_HIDE = 0,
       SW_SHOWNORMAL = 1,
       SW_NORMAL = 1,
       SW_SHOWMINIMIZED = 2,
       SW_SHOWMAXIMIZED = 3,
       SW_MAXIMIZE = 3,
       SW_SHOWNOACTIVATE = 4,
       SW_SHOW = 5,
       SW_MINIMIZE = 6,
       SW_SHOWMINNOACTIVE = 7,
       SW_SHOWNA = 8,
       SW_RESTORE = 9,
       SW_SHOWDEFAULT = 10,
       SW_FORCEMINIMIZE = 11,
       SW_MAX = 11
   }


   [DllImport("shell32.dll")]
   static extern IntPtr ShellExecute(
       IntPtr hwnd,
       string lpOperation,
       string lpFile,
       string lpParameters,
       string lpDirectory,
       ShowCommands nShowCmd);
//in button click event im calling
 ShellExecute(IntPtr.Zero, "open", "explorer.exe", @"F:", "", ShowCommands.SW_NORMAL);



大体上它工作正常,但是当我托管iis时它不工作

让我知道如何播种

谢谢,谢谢.........



loclally it''s working fine but when i hosting iis it''s not working

let me know how to sove this

Thanks and advance.........

推荐答案

您无法通过在服务器上执行代码来做到这一点-安全性不允许您这样做.该代码必须在客户端上执行.

但是,您可以通过在HTML中添加链接来做到这一点:
You cannot do it by executing code on the Server - security will not allow you. The code must be executed on the Client.

However, you can do it by putting a link into the HTML:
<a href="File://D:\Temp\" target="_blank">D:\Temp</a> 


所有ASP.NET代码都在服务器上运行,而不是在客户端上运行.因此,代码可能已经起作用,但是它只是在服务器上打开了资源管理器.
All ASP.NET code runs on the server, never on the client. So, the code may have worked, but it just opened Explorer on the server.


这篇关于如何从客户端打开指定的驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆