asp.net网站可以访问本地硬盘吗?
问题描述:
我在asp.net应用程序中有一个网站,它将部署在本地计算机上。我需要的是访问该机器的硬盘驱动器,因为我需要保存在该机器上的一些内容显示在我的网页上。所需内容将是视频文件。那么无论如何要实现这一目标吗?是否可以通过在iis配置中设置信任级别来实现此目的?
Hi,
I have a website in asp.net application and it will be deployed on local machine. What i need is to access the hard drive of that machine because i need some content saved on that machine to display on my webpage. The required content would be video files. So is there anyway to achieve this? Is it possible to do this by setting trust level in iis configuration?
答
使用服务器端代码,您可以访问服务器主机的本地硬盘驱动器,但只有为您的站点配置的根目录下的文件系统部分。而且您无法访问客户端系统。 (严格地说,在Windows上,对于某些浏览器来说,浏览器中托管的ActiveX组件有一种不安全的东西,但是任何精通安全的用户都知道你这样做了,他们可能不会回到你的网站不要做坏事。:-))-SA
With the server-side code, you can access the local hard drive of the server's host, but only the part of the file system under the root directory configured for your site. And you cannot access a client system. (Strictly speaking, on Windows, for some browsers, there is such a dirty an insecure thing as ActiveX components hosted in the browser, but is any security-savvy users learn that you do it, they probably won't come back to your site. Don't do evil. :-))—SA