0

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.

Chad Moran
  • 12,834
  • 2
  • 50
  • 72

1 Answers1

2

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.

Community
  • 1
  • 1
John Sheehan
  • 77,456
  • 30
  • 160
  • 194
  • 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 Jan 07 '09 at 22:05