[英]virtual directory with same name as controller action
I have a Asp.Net MVC controller with the url localhost/desktop . 我有一个URL为localhost / desktop的Asp.Net MVC控制器。 This works as it should.
这可以正常工作。 I now would like to add a virtual direcotry to IIS also hosted at localhost/desktop which returns static files.
我现在想将虚拟目录添加到IIS,该目录也托管在返回静态文件的localhost / desktop上。 So localhost/desktop should route to the asp controller action and anything in the desktop "directory" should just return static files.
因此, localhost / desktop应该路由到asp控制器操作,并且桌面“目录”中的任何内容都应该返回静态文件。 How would I go about this?
我将如何处理?
As far as I am aware the whole point of iis having shared folders etc is to serve files directly to the browser. 据我所知,具有共享文件夹等的iis的全部目的是将文件直接提供给浏览器。 You don't need to go through a controller.
您不需要通过控制器。 What you do want to do is give the user some way to browse the content of the folder providing a link to the required content.
您要做的就是为用户提供某种浏览文件夹内容的方法,并提供指向所需内容的链接。 The browser can then display the file if it supports rendering or download if it does not.
然后,如果浏览器支持渲染,则浏览器可以显示该文件;如果不支持,则可以下载。
MVC or should I say .Net will help you provide the info on the folder contents . MVC还是我应该说.Net将帮助您提供有关文件夹内容的信息。 You can of course enable folder browsing on iis but I can't imagine anyone would recommend that.
您当然可以在iis上启用文件夹浏览,但是我无法想象有人会建议这样做。 The .net library makes light work of building up a virtual view of a folder.
.net库简化了构建文件夹的虚拟视图的工作。 How you display this on the front end is up to you but Google will be your friend here.
您如何在前端显示此内容取决于您,但Google会成为您的朋友。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.