Best way to change the default 'View' item url

Topics: Customizing Orchard, Writing modules
Mar 21, 2013 at 10:02 PM
Edited Mar 21, 2013 at 10:03 PM
I have a Content Type without TitlePart (nor Autoroute Part), I want to display in a page a link to this item.
My first try was to use something as
new UrlHelper(RequestContext).RouteUrl(myItemMetadata.DisplayRouteValues
but this end with
/Contents/Item/View/Id
which I certainly don't want to use
So I defined a route with
Route = new Route( "myDesiredPath/{action}/{id}",
                    new RouteValueDictionary {
                        {"area", "mymodule"},
                        {"controller", "myController"},
                        {"action", "View"},
                        {"Id", UrlParameter.Optional} etc.
write a myController with action named View
write a myDriver wher a build the shape,

and force a link with
ApplicationRootUrlString() + "/myDesiredPath/view/"+Id


This seems over complicated! is there a more easy way to do this and avoid having the /myDesirePath/ forced in the code ?

I suppose one solution would be to add the Autoroute Part to my content type ?
But if I can't or don't want to add it ?
Coordinator
Mar 21, 2013 at 10:08 PM
create your route pointing to "Content", "Item", "Display"
Mar 21, 2013 at 11:05 PM
Evident ....now, Thanks