both rules are using the same pattern:
SOME-STRING / SOME- STRING / SOME- INTEGER

so the engine will match the first rule.
you need to differentiate the two.

say:

/search/<productName>/<categoryId>/
and
/product/<title>/<id>/

this way, URLs with "/search/STRING/INT" will match the first, and
"product/STRING/INT" will match the latter


On Thu, Feb 12, 2009 at 4:57 AM, eyal <[email protected]> wrote:

>
> hi all,
>
> For some reason one routing rule replaces the other. Meaning whenever
> I try to evoke MyView(id) func SearchResult(categoryId) is executed
> instead. Any ideas of how to fix this?
>
> thanks
> eyal
>
> I have the following routing rules:
>
>
>            rules.Add(new PatternRoute("/<controller>/<productName>/
> <categoryId>/")
>              .DefaultForArea().IsEmpty
>              .DefaultForAction().Is("searchresult")
>              .Restrict("categoryId").ValidInteger);
>
>            rules.Add(new PatternRoute("/<controller>/<title>/<id>/")
>                .DefaultForArea().IsEmpty
>                .DefaultForAction().Is("myview")
>                .Restrict("id").ValidInteger);
>
> Relating Url generated in view:
>
> Evokes SearchResult(categoryId) func
> $Url.Link($Product.Name, "%{controller='products',
> action='searchresult', params={categoryId=$Product.Id, productName=
> $Product.Name}")
>
> Evokes MyView(id) func
> $Url.For("%{controller='products', action='myview', params={id=
> $row.Id, title=$row.title}")
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to