views:

9

answers:

1

I'm using URL Rewrite module in IIS7 and using the User Friendly URL Rule template.

I'm trying to get URLs like:

Something/param1/something/param2/something/param3/something/something2/ etc.etc.

to rewrite to

SomethingEnd.aspx?param1=something&param2=something&param3=something/something2& etc.etc.

Using the templates, it automatically generates something like:

^SomethingEnd\.aspx$

to redirect to

Something/{C:1}/{C:2}/{C:3}/{C:4}/{C:5}/{C:6} etc.

and the reverse to be

^Something/([^/]+)/([^/]+)/?$

to be

SomethingEnd.aspx?{R:1}={R:2}

My problem is, how can I make it dynamic? Though there is a finite amount of params I have in my query string, I really don't want to make, for example, if I have 6 params, 6 separate rewrite rules (and the reverse applied).

I tried

^Something/([^/]+)*/?$

but that doesn't seem to work.

Any help would be greatly appreciated.

Thank you!

A: 

You can use split.


EDIT

Just as an example, in javascript, you can use this:

"Something/param1/something/param2/something/param3/something/something2/".split(/([^/]+)\/([^/]+)/)

And this returns an array:

["", "Something", "param1", "/", "something", "param2", "/", "something", "param3", "/", "something", "something2", "/"]

So, you need just a loop to get correct information.

Topera
Unfortunately, I can't use split using the URL Rewrite Module. I want to keep most of the URL rewriting to server side as much as possible.
MikiRei