TCM
TCM

Reputation: 16900

Url rewriting question

This is my rule set up in 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>

Basically I have my popups in webforms\visitor\popup. I want to write a rule that when any page is request within this popup directory. It gets redirected to some custom url.

For Eg.

If user requests webforms/visitor/popup/HelloWorld.aspx?a=1

He should be redirected to jwelery/HelloWorld/a/1

I just need the solution for what should I write in "INEEDTHEPAGEVARIABLEHERE" in Redirect action. Is there any special variable that I can use? I am using IIS7

Thanks.

Upvotes: 0

Views: 519

Answers (2)

citronas
citronas

Reputation: 19365

To answer your original question, you could use 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)

Upvotes: 0

Olaf
Olaf

Reputation: 10247

Why don't you use

<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}" />

?

Upvotes: 2

Related Questions