Question

I am having a tough time getting the regular expression right.

In the example below, the string is appended with _Schedule to go to the schedule.aspx page with the matching parameter.

I just cant seem to get the regular expression correct, but maybe it is, but I do not have the rewriteMap key correct.

If I use www.MyDomain.com/Friday_December_6_2013_700PM_Schedule, it is going to the schedule.aspx page, but not grabbing the the IDNum parameter.

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite for Schedule" stopProcessing="true">
<match url=".*?(_Schedule)" />
<action type="Rewrite" url="schedule.aspx?IDNum={Schedule:{R:1}}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="Schedule">
<add key="Friday_December_6_2013_700PM" value="21" />
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
</configuration>
Was it helpful?

Solution

Instead of

.*?(_Schedule)

try this

(.*?)_Schedule
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top