Hi, I have been struggling with this for a while now, and I can't seem
to get my head around it.
Lets say I have an action like this:
public virtual void Override( string token, string targetUrl )
I also have some routes defined:
engine.Add( new PatternRoute( "/<language>/<controller>/
<action>" )
.Restrict( "language" ).ValidRegex(
"^[a-z]{2}$" )
.Restrict( "controller" ).ValidRegex(
"^[a-zA-Z]+$" )
.Restrict( "action" ).ValidRegex( "^[a-zA-Z]+$"
);
And I want to generate an url for this using the RoutingEngine. So I
invoke this:
var parameters = new HybridDictionary
{
{ "language",
Config.DefaultLanguage.LanguageCode },
{ "controller", "communication" },
{ "action", "override" },
{ "token", marketOverride.Token },
{ "targetUrl", targetUrl }
};
engine.CreateUrl(parameters);
But this returns null, because it doesn't match all parameters. I
would preferably want it to select the most significant route, and
then add the unknown parameters as a querystring, so that it would
match the Controller action, regardless of the routes I have. Like
this:
/en/communication/override?token=kj3h4k2jh34&targetUrl=someurl
Because, lets say that I would extend my routes (or use another route
provider) that would have:
engine.Add( new PatternRoute( "/<language>/<controller>/<action>/
<token>/<targetUrl>" )
.Restrict( "language" ).ValidRegex(
"^[a-z]{2}$" )
.Restrict( "controller" ).ValidRegex(
"^[a-zA-Z]+$" )
.Restrict( "action" ).ValidRegex( "^[a-zA-Z]+$"
);
Then I would want it to generate:
/en/communication/override/kj3h4k2jh34/someurl
But somehow I get the feeling that the RoutingEngine can't handle
that. Is there any way to achieve this? I'm still on Monorail 2.0.0,
if an upgrade has this advantage I would gladly like to know.
Regards, Jimmy
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.