views:

12

answers:

1

I have 2 namespaces for my controllers. One is the default MyProject.Controllers and the second is MyProject.Controllers.Framed. I am using namespaces so that I can have a url like /home/index serve up the normal home website and /framed/home/index serves up a version intended for use in an iframe.

My problem is that when I put <%: Html.ActionLink("Home", "Index", "Home")%> in my view, it defaults to /Framed/Home/Index. I believe this is because the framed namespace is added first in my routing and it is found first. That's to be expected and desired.

My problem is how to I set the namespace used in my actionlink? Ideally I'd like my website to default all actionlinks to the default namespace (MyProject.Controllers). I'm beginning to wonder if the convenience of putting /framed in the url to change the rendering is worth all this hassle.

+1  A: 

You could try using the RouteLink method that provides a way to specify the route to be used:

<%: Html.RouteLink("FramedRouteName", new { controller: "Home", action: "Index" }) %>
marcind