tags:

views:

97

answers:

1

How do you retrieve the matching route for a URL (in string format)?

Basically something like...

Routes.GetMatchingRoute("http://mysite.com/foo/bar/1");

Without having a HttpContext.

Basically I would like to RedirectToAction using a referring URL.

+2  A: 

You could just return Redirect(url); instead of RedirectToAction();

I recall seeing someone ask that on SO before, but I can't find the question.

Edit: here it is (note the edit by the OP), there was no answer there either.

John Sheehan
Sorry I was unclear. I also would like to pass the product model back into the redirect so it can repopulate form elements. With Redirect you can't pass in the model.
Chad Moran
You should update your original question with more detail
John Sheehan