Asp.net 重写URL所需的正则表达式
我正在尝试制定重写规则,以检查URL是否以Asp.net 重写URL所需的正则表达式,asp.net,regex,url-rewriting,Asp.net,Regex,Url Rewriting,我正在尝试制定重写规则,以检查URL是否以.htm或.html结尾,但不包含Archive.aspx url开始时如下所示 www.contoso.com/test.htm (or .html) 结果就像 www.contoso.com/Archive.aspx?page=/test.htm 如何使用正则表达式执行此操作?您可以使用负前瞻:(?!Archive\.aspx)。*\.html?$您可以使用负前瞻:(?!Archive\.aspx)。*\.html?$
.htm
或.html
结尾,但不包含Archive.aspx
url开始时如下所示
www.contoso.com/test.htm (or .html)
结果就像
www.contoso.com/Archive.aspx?page=/test.htm
如何使用正则表达式执行此操作?您可以使用负前瞻:
(?!Archive\.aspx)。*\.html?$
您可以使用负前瞻:(?!Archive\.aspx)。*\.html?$