将 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 中。
我要发送的示例网址是 www.xyz.com/go/geneva/2010/welcome/t5RT4W - 然后我会在 mypage.aspx 中提取日内瓦、2010、welcome 和 t5RT4W 的信息,即使它会接收控制权生活在 www.xyz.com/go/mypage.aspx。
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论