简体   繁体   English

IIS URL重写模块:“无限”对变量?

[英]IIS URL Rewrite Module: “Infinite” Pairs of variables?

What single pattern would support all of these url forms (and their rewritten forms)? 哪种单一模式可以支持所有这些url形式(及其重写形式)?

http://www.domain.com/varAName/varAValue http://www.domain.com/?varAName=varAValue http://www.domain.com/varAName/varAValue http://www.domain.com/?varAName=varAValue

http://www.domain.com/varAName/varAValue/varBName/varBValue http://www.domain.com/?varAName=varAValue&varBName=varBValue http://www.domain.com/varAName/varAValue/varBName/varBValue http://www.domain.com/?varAName=varAValue&varBName=varBValue

http://www.domain.com/varAName/varAValue/varBName/varBValue/varCName/varCValue http://www.domain.com/?varAName=varAValue&varBName=varBValue&varCName=varCValue http://www.domain.com/varAName/varAValue/varBName/varBValue/varCName/varCValue http://www.domain.com/?varAName=varAValue&varBName=varBValue&varCName=varCValue

The wizard for User-Friendly URLs is nice, but the RegEx it writes makes every position of the pattern required. User-Friendly URL向导很不错,但是它编写的RegEx使所需模式的每个位置成为可能。 I need one that essentially would support MANY key/value pairs. 我需要一个本质上将支持许多键/值对的对象。

It isn't possible with IIS URL Rewrite 2, since it doesn't support many matchings for inbound URLs. IIS URL Rewrite 2是不可能的,因为它不支持入站URL的许多匹配。

You would need to create N rules to match each "length" - Be sure of creating the rules in a web.config and not in ApplicationHost.config (Server Rule), because it will use a rewrite cache for very efficient rewriting. 您将需要创建N条规则来匹配每个“长度”-确保在web.config中而不是在ApplicationHost.config(服务器规则)中创建规则,因为它将使用重写缓存来非常有效地进行重写。

Second option is to create a custom provider in C#/.NET; 第二种选择是在C#/。NET中创建一个自定义提供程序。 but that requires coding . 但这需要编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM