Linux 将 IIS 请求路由到父文件夹资源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3677036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Route IIS request to parent folder resource
提问by DEH
I would like to create an asp.net page in my site within a particular folder e.g. at www.xyz.com/go/mypage.aspx. I would then like any requests that are routed to sub-folders of /go to actually route the request to this page. i.e. a request to www.xyz.com/go/test/123 should actually end up being handled by /go/mypage.aspx. (Indeed, it is important that /go/test/123 does not actually have to exist - it won't). Within the page I would then analyse the original path (/go/test/123) because it will contain embedded meaning. In this way I can issue any number of urls to users, but all requests will end up at mypage.aspx. The reason I am doing this is so I can issue personalised urls that look good but always arrive at the same page, which can then deal with the request accordingly. I do not want the sub-folders to have to exist. Ideally the users would also not have to specify a particular aspx page, but would just enter a url that has the necessary codes within it. In essence I would like to replace querystring parameters with 'virtual' directory paths where the paths don't actually exist in IIS.
我想在我的站点中的特定文件夹中创建一个 asp.net 页面,例如在 www.xyz.com/go/mypage.aspx。然后,我希望路由到 /go 子文件夹的任何请求实际将请求路由到此页面。即对 www.xyz.com/go/test/123 的请求实际上应该由 /go/mypage.aspx 处理。(确实,重要的是 /go/test/123 实际上不必存在 - 它不会存在)。在页面内,我将分析原始路径 (/go/test/123),因为它将包含嵌入的含义。通过这种方式,我可以向用户发出任意数量的 url,但所有请求都将在 mypage.aspx 结束。我这样做的原因是我可以发布看起来不错但总是到达同一页面的个性化网址,然后可以相应地处理请求。我不希望子文件夹必须存在。理想情况下,用户也不必指定特定的 aspx 页面,而只需输入包含必要代码的 url。本质上,我想用“虚拟”目录路径替换查询字符串参数,其中路径在 IIS 中实际上并不存在。
An example url that I would send would be www.xyz.com/go/geneva/2010/welcome/t5RT4W - I would then extract the info of geneva, 2010, welcome and t5RT4W in mypage.aspx which will receive control even though it lives at www.xyz.com/go/mypage.aspx.
我将发送的示例 url 是 www.xyz.com/go/geneva/2010/welcome/t5RT4W - 然后我将在 mypage.aspx 中提取日内瓦、2010、welcome 和 t5RT4W 的信息,即使它会接收控制住在 www.xyz.com/go/mypage.aspx。