我的web.config文件有基本的重写规则,可以将我的网址转换为小写。
完美除了一个问题:我在我的电子邮件中传递区分大小写的令牌,允许用户更改用户名/电子邮件
如何在查询字符串保持区分大小写的同时制作使我的网址小写的重写规则?
示例:
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
制作此网址: http://resources.championscentre.org/ConfirmChangeEmail/abcDEfGhIJKlmn
进入这个: http://resources.championscentre.org/confirmchangeemail/abcdefghijklmn
但需要: http://resources.championscentre.org/confirmchangeemail/abcDEfGhIJKlmn
答案 0 :(得分:2)
正则表达式应为
^[\w:\/\.]*\/
\w is [a-zA-Z0-9]
^
支持开始。
^[\w:\/\.]*
匹配任何字母数字或/
或:
或.
/
确保选择了最后一个/
。 (假设您的网址不以/结尾)
<rule name="Convert to lower case" stopProcessing="true">
<match url="^(.*[A-Z].*)(\/.*)" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:1}}{R:2}" redirectType="Permanent" />
</rule>