views:

189

answers:

1

Hi.

Is there any way hot to get RouteData from url string?

I have login form with returlUrl as query string parameter. My routes are defined as : {languageCode}/{controller}/{action}

In action method LogIn(string returlUrl) the returlUrl is something like "en/home/contacts" etc. I need to change languagePart a i dont want to use string.Replace, as routes may change in future.

Thank you.

A: 

This forums thread might be useful: http://forums.asp.net/t/1281667.aspx

This is the best option I can think of off the top of my head. Bascially, using RouteTable.Routes.GetRouteData and Mocking HttpContextBase based on your Url string.

Jeff T