0

这是我在 web.config 中设置的规则:

   <rule name="RedirectPopups" stopProcessing="true">
              <match url="^webforms/visitor/popup/*" />
              <conditions>
                <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
                <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" />
              </conditions>
              <action type="Redirect" url="jwelery/INEEDTHEPAGEVARIABLEHERE/{C:1}/{C:2}" appendQueryString="false" redirectType="Permanent" />
            </rule>

基本上我在 webforms\visitor\popup 中有我的弹出窗口。我想写一个规则,当在这个弹出目录中请求任何页面时。它被重定向到一些自定义 url。

例如。

如果用户请求webforms/visitor/popup/HelloWorld.aspx?a=1

他应该被重定向到jwelery/HelloWorld/a/1

我只需要在重定向操作中的“INEEDTHEPAGEVARIABLEHERE”中写什么的解决方案。我可以使用任何特殊变量吗?我正在使用 IIS7

谢谢。

4

2 回答 2

2

你为什么不使用

<match url="^webforms/visitor/popup/([a-zA-Z0-9]+).aspx\?([a-zA-Z0-9]+)=([a-zA-Z0-9]+)$" />
<action type="Rewrite" url="jwelery/{R:1}/{R:2}/{R:3}" />

?

于 2011-08-18T09:20:21.793 回答
0

要回答您最初的问题,您可以使用 UrlRouting。
( http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series .aspx )

于 2011-08-19T13:43:27.893 回答