[英]iis 7 url rewrite with preset paths
I'm trying to make something like this work in iis 7, or web config 我正在尝试在IIS 7或Web配置中进行类似的工作
request: products.aspx?id=100
要求:
products.aspx?id=100
rewrite: domain/products/mp3
重写:
domain/products/mp3
Please note, I do not want redirection, for domain/products/mp3
is invalid path, I just want the url rewrite so the user sees this path but the server serves the actual request. 请注意,我不希望重定向,因为
domain/products/mp3
是无效的路径,我只想重写url,以便用户看到此路径,但服务器可以满足实际的请求。
Can you help? 你能帮我吗?
Can you use the URL Rewrite functionality from ASP.NET instead? 您可以改用ASP.NET的URL重写功能吗? That was built for that.
那是为此而建的。
RouteTable.Routes.MapPageRoute("Test", "domain/products/{type}", "~/products.aspx");
Then in products.aspx you have to map from mp3 to 100 somehow, but I assume you have a db table for that anyway. 然后在products.aspx中,您必须以某种方式将mp3映射到100,但无论如何我都认为您有一个db表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.